|
Matt.Haas@xxxxxxxxxxx wrote:
Jerry, You don't need prototypes to do this. You can define the input parameter in the called program as a string the length of your data structure and then move that parameter into a copy of your data structure in the called program. Matt -----Original Message----- From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Jerry Adams Sent: Wednesday, October 04, 2006 8:50 AM To: RPG Midrange Subject: Passing a data structure as a parmI have a whole mess of data elements that I need to pass to another program so I thought that using a data structure would be more concise than something like: PGM(parm1:parm2:...parm13); . I think Bob's book (4th ed.) explained how to do this with prototypes, but, since it'll be awhile before I can actually get around to testing this, I thought perhaps someone might have suggestions or criticisms (both willingly accepted) of how I implemented it. Code samples are below. D SIPROTO DS D #End 1A D blitm# D blsqty D bltxcd D bllc01 D bllc02 D bllc03 D blcust D blref# D dlspst D dlsp01 D dlsp02 D dlsp03 D SIU002 PR ExtPgm('SIU002') D SIUAddr Like(SiProto)Later the actual "call": SIU002(SiProto); SIU002 (the humble callee) has this as the prototype:D SIU002 PR D Parms Like(SiProto) D SIU002 PI D InParms Like(SiProto) D SiProto DS Based(pSiProto) D #End 1A D #Item 5S 0 D #Qty 5P 0 D #TaxCode 5A D #Local1 5A D #Local2 5A D #Local3 5A D #Cust 5S 0 D #Ref 6S 0 D #StStamps 5P 0 D #Lc1Stamps 5P 0 D #Lc2Stamps 5P 0 D #Lc3Stamps 5P 0Then, as the first step in the program: pSiProto = %Addr(inParms);Am I doing this right?Thanks.
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.