might this just be a possible "pay-attention-thing" when using XML-INTO
(it is friday the 13th with a reason today ?)
i'm having a single program that :
1. reads all xml-documents from a certain folder
2. the xml-data is read into a data-structure using xml-into
3. do something with the data
DS-declaration :
the code that reads in the xml into the datastructure ds_fld
2 example-files that has been used
FILE1.XML
FILE2.XML
when executing the program the output was
so the ds_fld-receiver from the xml-into is not cleared from the first xml-into-operation
the B-value from the first operation remains
a forced clear from the DS is suitable to be executed before the xml-into is done
or how do you encode the "dow"-loop do detect the end of the data that has been read into the DS ?
maybe my check on the *blanks is not the right way
(it is friday the 13th with a reason today ?)
i'm having a single program that :
1. reads all xml-documents from a certain folder
2. the xml-data is read into a data-structure using xml-into
3. do something with the data
DS-declaration :
Code:
* XML FORMAT ******************************************************************************** d d ds_namval ds d fld_nam 20 d fld_val 20 d d ds_fld ds qualified d fld dim(30) likeds(ds_namval) d
Code:
z_text = 'FILE ' + %trim(file_b); write ltext; xmlfile = %trimr(w_soap_fil); options = 'doc=file + path=header/detail + ccsid=best + case=any + allowextra=yes + allowmissing=yes' ; monitor; //ds_fld = *blanks; xml-into ds_fld %xml(xmlfile:options); i = 1; dow i < 30 and ds_fld.fld(i).fld_nam <> *blanks; z_text = ds_fld.fld(i).fld_nam + ' ' + ds_fld.fld(i).fld_val; write ltext; i = i + 1; enddo; on-error *all; z_text = 'Ongeldige XML-inhoud'; write ltext; endmon;
FILE1.XML
Code:
<header> <detail> <fld> <fld_nam>A</fld_nam> <fld_val>1</fld_val> </fld> <fld> <fld_nam>B</fld_nam> <fld_val>2</fld_val> </fld> </detail> </header>
Code:
<header> <detail> <fld> <fld_nam>C</fld_nam> <fld_val>3</fld_val> </fld> </detail> </header>
Code:
FILE file1.xml A 1 B 2 FILE file2.xml C 3 B 2
the B-value from the first operation remains
a forced clear from the DS is suitable to be executed before the xml-into is done
or how do you encode the "dow"-loop do detect the end of the data that has been read into the DS ?
maybe my check on the *blanks is not the right way
Comment