Barbara,
You're right, of course like-ds I meant.
I built huge structures for importing the UBL Order BIS 3.0 definition in
this manner.
So I'm able to import this data all at once.
But it took quite a bit of work and testing.
kf
-----Ursprüngliche Nachricht-----
Von: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxxxxxxxx] Im Auftrag von
Barbara Morris
Gesendet: Mittwoch, 14. August 2024 23:07
An: rpg400-l@xxxxxxxxxxxxxxxxxx
Betreff: Re: AW: xml-into
On 2024-08-03 8:21 a.m., myibmi via RPG400-L wrote:
I recommend to work whenever possible with templates.
Example with your data:
dcl-ds xmldata;
file_in like t_file-in dim(100);
cnt_file-in int(5);
end-ds;
dcl-ds t_file_in template;
dcl-ds header;
dcl-subf file_number int(5);
end-ds;
service like tsf_service;
end-ds;
...
I think you meant to use LIKEDS, not LIKE.
With LIKE, file_in would be a CHAR subfield, not a sub-data-structure.
But aside from that, it's interesting that you prefer templates. One of
the reasons we added nested data structures to RPG was because it could
be difficult to understand complicated data structures for XML-INTO when
the final data structure definition was spread out over several small
data structures.
So, for me, the only time I would use a template for one of the nested
data structures would be when I actually wanted the smaller data
structure for something else, like a parameter for a procedure that only
handled some small part of the data.