|
A close example: D File E ds extname(iim) D FileName s 10a C/exec sql C+ Select 'IIM', a.* C+ into :FileName,:File C+ from iim a C+ where iprod='JI' C/end-exec /free *inlr=*on; return; /end-free Rob Berendt -- "They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." Benjamin Franklin "Mike Naughton" <mnaughton@juddwi To: rpg400-l@midrange.com re.com> cc: Sent by: Fax to: rpg400-l-admin@mi Subject: DS Within DS (?) drange.com 12/19/2001 10:08 AM Please respond to rpg400-l Hi Everyone, Is there a way to do the following? I have two files, FILEA & FILEB, which have identical formats In a program, I want to select all records from both files using embedded SQL, so I 1) define a data structure using EXTNAME to base it on FILEA, 2) declare a cursor for the union of the two files, and 3) fetch the cursor into the data structure. So far, so good -- that all works fine. Now, I want to add an extra field telling me what file the fields came from -- in other words, I want a statement something like: select 'FROMFILEA', A.* from FILEA A UNION select 'FROMFILEB',B.* from FILEB B I still want to put the result into a data structure (since I don't want to type in all the field names), but the data now no longer matches the file structure. Is there a way to define a data structure that is partly externally-defined and partly internally-defined? Or to have a data structure that includes another data structure? Or something?? TIA, Mike Naughton Senior Programmer/Analyst Judd Wire, Inc. 124 Turnpike Road Turners Falls, MA 01376 413-863-4357 x444 mnaughton@juddwire.com _______________________________________________ This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list To post a message email: RPG400-L@midrange.com To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/cgi-bin/listinfo/rpg400-l or email: RPG400-L-request@midrange.com Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l.
As an Amazon Associate we earn from qualifying purchases.
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.