|
Ben, I've run into SQL's complaints in a similar situation involving arrays. One way around it, is to specify the individual fields instead of the DS on the fetch into. HTH, Charles > -----Original Message----- > From: Ben_Pforsich@xxxxxxxxxxxx [mailto:Ben_Pforsich@xxxxxxxxxxxx] > Sent: Tuesday, March 30, 2004 12:03 PM > To: rpg400-l@xxxxxxxxxxxx > Subject: Grouping predefined fields? > > > > > > > On V5R2, is there any easy way to group predefined fields in a data > structure or something similiar? > > I have two fields called HSMTYP and HSMCAT from an external > file that I > wish to always compare as one field (the two concatenated). These two > fields are defined as part of an externally-defined data > structure which > I'm using to fetch data directly from an SQL cursor. I've > tried creating a > new subfield within the same data structure and using the > overlay keyword, > but the SQL fetch fails because there are "too many host variables." > What's the best way to do this? > > I feel like I'm missing something obvious. Thanks! > > Ben > > > Here's a code snippet which doesn't run correctly: > > * Data structure to receive SQL records > * Fields HSMCAT and HSMTYP are defined in file CUIMHSWK starting at > position 8 > dC1Rec e ds extname(CUIMHSWK) > d C1Buffer 1 159 > d C1CatTyp 4 overlay(C1Buffer:8) > > c/exec SQL > c+ declare C1 cursor for > c+ select * > c+ from CUIMHSWK > c/end-exec > > c/exec SQL > c+ open C1 > c/end-exec > > c/exec SQL > c+ fetch C1 into :C1Rec > c/end-exec > > * Instead of saying this... > ***** if HSMTYP = 'I' and HSMCAT = 'RCV' > * I want to say this... > c if C1CatTyp = 'IRCV' > * ...without having to do this explicitly > ***** eval C1CatTyp = HSMCAT + HSMTYP > > _______________________________________________ > 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.