× 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.



Not tested and off the top of my head...

dcl-ds xmldata;
dcl-ds file_in dim(2);
dcl-ds header;
dcl-subf file_number int(5);
end-ds;
dcl-ds service;
dcl-subf label varchar(20);
dcl-ds data;
dcl-ds contract dim(2);
dcl-subf num_contract int(5);
end-ds;
end-ds;
end-ds;
end-ds;
end-ds;

You'll need to add a count field for the array DS's unless they are always
2...

Charles


On Fri, Aug 2, 2024 at 12:07 PM Dave <dfx1@xxxxxxxxxxxxxx> wrote:

Hi,

Not having much fun using XML-INTO and nested DS arrays :-(

I need an array at the end something like this
fileIn(1).header.file_number = 31
fileIn (1).contract(1).num_contract = 741
fileIn (1).contract(2).num_contract = 750
fileIn (2). header.file_number = 42
fileIn (2).contract(1).num_contract = 850
fileIn (2).contract(2).num_contract = 950

I've tried pulling the whole of my xml file into 1 DS (this came out
empty, I'm not sure if XML-INTO knows how to do this).
I can get the "header" elements into one DS array and the "contract"
elements into another :

Header(1). file_number = 31
Header(2). file_number = 42

contract(1).num_contract = 741
contract(2).num_contract = 750
contract(3).num_contract = 850
contract(4).num_contract = 950

Obviously that's not good as I've lost the relation
file_number/num_contract.

Thanks for any help.

My Xml

<xmldata>
<file_in>
<header>
<file_number>31</file_number>
</header>
<service>
<label>label1</label>
<data>
<contract>
<NUM_contract>741</NUM_contract>
</contract>
<contract>
<NUM_contract>750</NUM_contract>
</contract>
</data>
</service>
</file_in>
<file_in>
<header>
<file_number>42</file_number>
</header>
<service>
<label>label2</label>
<data>
<contract>
<NUM_contract>850</NUM_contract>
</contract>
<contract>
<NUM_contract>950</NUM_contract>
</contract>
</data>
</service>
</file_in>
</xmldata>
--
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related
questions.



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.