Hello community,
thanks for clicking my question - I had trouble making myself clear in the title.
I get a Process Report which contains a XML answer from a server I get with cURL.
Excerpt:
<Envelope>
<JOB_STATUS>COMPLETE</JOB_STATUS>
<PARAMETER>
<NAME>SQL_UPDATED</NAME>
<VALUE>12</VALUE>
</PARAMETER>
<PARAMETER>
<NAME>DUPLICATES</NAME>
<VALUE>0</VALUE>
</PARAMETER>
[...]
First I wanted to check for the JOB_STATUS to be complete. I found the answer in the forum here:
:SET &HND# = PREP_PROCESS_REPORT(,,"REP","*<JOB_STATUS>*")
:PROCESS &HND#
: SET &RET# = GET_PROCESS_LINE(&HND#)
: set &pos1# = str_find(&RET#,"<JOB_STATUS>")
: set &pos1# = &pos1# + 12
: set &AlertID# = substr(&RET#,&pos1#)
: SET &RET# = STR_SUBSTITUTE (&AlertID#, "</JOB_STATUS>", "")
: print &RET#
: IF &RET# <> "COMPLETE"
: PRINT "Der Job lässt die Complete Meldung in der XML Response vermissen."
: EXIT 1
: ENDIF
:ENDPROCESS
This code browses through the report to find <JOB_STATUS>. Go to position + 12 characters (which is the C of the word COMPLETE) until the end. In a second step it deletes </JOB_STATUS> which leaves nothing then COMPLETE.
Wonderful so far.
But getting the complete message from the server is not 100% save. The parameter SQL_UPDATED, which describes updates SQL rows, is more save. So I want to check for VALUE containing <> 0. But in the report there is more than one parameter - name - value structure.
How to search for a line containing SQL_UPDATED, take the next line and extract the value from there?
I can't thank you enough if I get an answer again from the real automic professionals.
Thanks in advance
Sönke