×
The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.
On 1/26/2012 11:08 AM, MRiggins@xxxxxxxxxxxx wrote:
There are no parsing errors received using the %HANDLER. I do convert the
XML CCSID to 1208 before running the program. If someone would be able to
take a look and see what error I am making it would be greatly
appreciated. I have included the basic program and the XML example.
You're not getting an error because you specified allowmissing=yes, and
it allowed everything to be missing. I recommend you (and everyone) drop
allowmissing=yes in favour of the countprefix option. With countprefix
you have to do more coding to add the counter subfields to your data
structure, but you have much more control over what you want to allow to
be missing.
Say you know that CasePack might not be present in the XML, then you'd
code a counter subfield, starting with a prefix, say "num" and ending
with CasePack.
D PoDetailType ds
D LineNumber 6
...
D SlsCnfNum 15
D SlsCnfDate 6
D CasePack 9
D AirFrtFlg 1
D AirFrtRsp 10
DAssistChargeReq 1
D AsstCharge 15
* Countprefix subfields for optional XML data
D numCasePack 10i 0
Then instead of allowmissing=yes, you'd code countprefix=num and then in
your processing, you'd check whether numCasePack had a count of 0 or 1
to see if CasePack had been in the XML for that element. Just add a num
subfield for anything that's optional in the XML, and then if something
is missing that's not optional, you'll get an error from XML-INTO.
Or, add a counter subfield for every subfield, and do your own
post-XML-INTO validation on which information you want to allow to be
missing.
http://publib.boulder.ibm.com/infocenter/iseries/v7r1m0/topic/rzasd/sc0925081031.htm#countprefixopt
For folks still on v5r4 that don't have the countprefix option, I
recommend leaving out allowmissing=yes while first developing the
XML-INTO code, and just make sure your sample XML doesn't have anything
missing (if you need arrays, keep the number of elements in the RPG and
XML small, say 2, so you don't need to provide too much XML data). Then
when it's working in general, you can put the dimensions back up where
they should be, and add the allowmissing=yes back in.
As an Amazon Associate we earn from qualifying purchases.