× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Booth and Matt,


Thanks.  I hadn't thought of doing it that way in the Callee.


Tommy,

Thanks for the confirmation. I'm not yet comfortable with addresses; probably because I don't use them. I'll probably stick with the original method just to get a little more experience (and to confuse the heck out the guy that takes my place!).


        * Jerry C. Adams
*IBM System i5/iSeries Programmer/Analyst
B&W Wholesale Distributors, Inc.* *
voice
        615.995.7024
fax
        615.995.1201
email
        jerry@xxxxxxxxxxxxxxx <mailto:jerry@xxxxxxxxxxxxxxx>



Booth Martin wrote:

Why not just create a DDS for a file to match your parm list, then externally describe the Data Structure to be like the file?

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 parm

I 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 0

Then, 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 thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.