First nested data structures are NOT supported.
But what happens if you try the following (I didn't try it myself).
DCL-DS JL0099 ExtName(JBTJK0099: *ALL) Qualified Dim(100);
DCL-DS JL0110 ExtName(JBTJK0110: *ALL) Qualified Dim(100);
DCL-DS JL0120 ExtName(JBTJK0120: *ALL) Qualified Dim(100);
exec sql fetch from [cursor] for 100 rows into :JL0099, :JL0110, :JL0120;
BTW for performance issues it is never a good idea to fetch all columns. It
is much better if you read exactly what you need.
Mit freundlichen Grüßen / Best regards
Birgitta Hauser
"Shoot for the moon, even if you miss, you'll land among the stars." (Les
Brown)
"If you think education is expensive, try ignorance." (Derek Bok)
"What is worse than training your staff and losing them? Not training them
and keeping them!"
?Train people well enough so they can leave, treat them well enough so they
don't want to.? (Richard Branson)
-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of
Englander, Douglas
Sent: Donnerstag, 2. Februar 2017 17:01
To: rpg400-l@xxxxxxxxxxxx
Subject: Embedded SQL into a DS of multiple DS
I am trying to perform a FETCH into a DS, with that data structure being
defined smaller DSs, each DS being the fields in a table that the SQL SELECT
selects from.
Does anyone know if it is possible to do something like this:
D JL0099 E DS ExtName(JBTJL0099 : *ALL)
D JL0110 E DS ExtName(JBTJL0110 : *ALL)
D JL0120 E DS ExtName(JBTJL0120 : *ALL)
dcl-ds DS_ALL dim(100) qualified;
d1_ds likeds(jl0099);
d2_ds likeds(jl0110);
d3_ds likeds(jl0120);
end-ds;
then:
exec sql fetch from [cursor] for 100 rows into :ds_all
The SQL is a join of 4 tables, but I can't get this to compile. I get the
"SQL0312 Variable DS_ALL not defined or not usable" error. Can you fetch
into a DS of DSs?
Thank you,
Doug
--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L)
mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
http://archive.midrange.com/rpg400-l.
Please contact support@xxxxxxxxxxxx for any subscription related questions.
Help support midrange.com by shopping at amazon.com with our affiliate link:
http://amzn.to/2dEadiD
As an Amazon Associate we earn from qualifying purchases.