|
Ben, I see no reason why you need to define each of the DS fields again in the MODS. Just move in and out data from JPP010 to JPPfields, defining JPPfields with a LIKE(JPP010) instead (this defines JPPfields as the size of JPP010). Just be sure you are certain there are no columns returned as null. Thank you, Matt Tyler WinCo Foods, Inc mattt@xxxxxxxxxxxxxx -----Original Message----- From: Ben_Pforsich@xxxxxxxxxxxx [mailto:Ben_Pforsich@xxxxxxxxxxxx] Sent: Tuesday, August 17, 2004 12:07 p To: rpg400-l@xxxxxxxxxxxx Subject: Can SQL recognize a nested data structure? I'm trying to load records into a MODS which I want define as having all the fields of a particular external file with the addition of a field to hold the RRN. I can do this for single-row fetches, but how do I do this for multiple-row fetches where I need to use a MODS? <code fragment> d JPP010 e ds qualified d DS1 ds occurs(10) d RRN 10s 0 d JPPfields likeds(JPP010) c/exec SQL c+ declare C1 cursor for c+ select rrn(A), A.* c+ from JRP010 A c+ where R1COM = :Company and R1IYR * 100 + R1IWK between c+ :FromIYRIWK and :ToIYRIWK c/end-exec c/exec SQL c+ open C1 c/end-exec c/exec SQL c+ fetch from C1 for 10 rows into :DS1 c/end-exec </code fragment> I'm getting an SQL precompiler error stating "host structure array DS1 not defined or not usable". When I bypass the SQL precompiler by using CRTBNDRPG, I get a little more info: "LIKEDS keyword is not allowed within a data structure that is not qualified" I could try just defining each field in JPP010 in the data structure, but there a lot of fields to define and didn't want to make the code more bloated than I had to. Has anyone tried something like this successfully? We're on V5R2. Ben Pforsich Programmer Analyst Bob Evans Farms, Inc. I/S Department Columbus, Ohio Ben_Pforsich@xxxxxxxxxxxx -- This is the RPG programming on the AS400 / 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.
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.