|
Frankly, you're way may be simpler - and more reliable. Sometimes after executing the following: D File E ds extname(iim) based(pFile) D NewDS ds D FileName 10a D FileData like(File) /free pFile=%addr(FileData); /end-free C/exec sql C+ Select 'IIM', a.* C+ into :newds C+ from iim a C+ where iprod='JI' C/end-exec /free *inlr=*on; return; /end-free the values of the fields in File are inconsistent. Sometimes only the first field has a value - sometimes they all have values. Gotta love inconsistencies. 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: Re: DS Within DS (?) drange.com 12/19/2001 12:34 PM Please respond to rpg400-l Hi Rob, You're right -- that works great (and thanks for the quick example!), but wouldn't it be simpler just to use: 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 -- no need for pointers or 2nd ds. . . . ? (this is what Darren suggested, and it works great, too). Either one solves my immediate problem (thanks again!), but it looks as if there's no way to shorten the SQL "into" clause to only one destination name? In the example, it's really no big deal, but suppose I wanted to SELECT A.*, B.* FROM IIM A JOIN FMA B ON . . . and put the whole thing into a data structure . . . .? Just wondering . . . rpg400-l@midrange.com writes: >If you were talking about the following: >D File E ds extname(iim) based(pFile) >D NewDS ds >D FileName 10a >D FileData like(File) > /free > pFile=%addr(FileData); > /end-free > >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 > >That works also. > >Rob Berendt 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.