|
Ben, If all you want to do is use the two fields as one try using the data structure you already have. I don't remember if I have done this with SQL returned data sets but I have used it a lot for other situations where I want to combine fields. In your situation the data structure would serve two purposes; declare the return variables and define the concatenated fields. c if HSMTYP = 'I' and HSMCAT = 'RCV' Would become c if C1Rec = 'IRCV' HTH, Rick -----Original Message----- From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]On Behalf Of Ben_Pforsich@xxxxxxxxxxxx Sent: Tuesday, March 30, 2004 11:03 AM 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
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.