On 8/16/2013 9:28 AM, RPGLIST wrote:
I think I may have found my answer... If I make that subfield in the DS an
array it should allow for multiples...


Once you get it working, you'll need to specify an option to allow fewer values in the XML than you have in the RPG data structure.

I recommend that you use the countprefix option for this. http://pic.dhe.ibm.com/infocenter/iseries/v7r1m0/topic/rzasd/sc0925081031.htm

Assuming your data structure looks something like this:

* Untested, probably wrong columns
D pickups_t ds qualified template
D num_pickup 10i 0
D pickup 25a varying dim(100)

D loads ds qualified
D shipper 25a varying
D consignee 25a varying
D pickups likeds(pickups_t)

You can code your XML-INTO like this:
xml-into loads %xml(whatever : ' countprefix=num_');

for i = 1 to loads.pickups.num_pickup;
... process loads.pickups.pickup(i)
endfor;

If you currently don't have quite the right data structure, and your XML-INTO isn't failing, then I'm guessing you are using option 'allowmissing=yes'. The countprefix option is a safer and more granular way of specifying which subfields you want to allow to be missing.

You can also use it to allow non-array subfields to be missing. If you wanted to allow the shipper value to be missing (for some strange reason), then you would just add a num_shipper numeric subfield to your data structure, and then it would just have a zero after the XML-INTO if the shipper value wasn't in the XML.

By using countprefix, you have much less chance of having XML-INTO "work" (complete without an exception, whether correctly or not) when the RPG data structure doesn't really match the XML document structure.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.