|
I want to know if this will work. I have a main program calling a subprogram (XCPRIC) that I am prototyping. The parms are external data structures. The prototype (copied in to main program and subprogram) looks like this:
D XCPRIC PR ExtPgm('XCPRIC') D pCustDS LikeDS(CustDS) D pItemDS LikeDS(ItemDS) D pInvDS LikeDS(InvDS)
To solve this problem I suggest:
So I suggest that the /COPY book with the prototype look like this:
/if defined(XCPRIC_COPYBOOK)
/eof
/endif
/define XCPRIC_COPYBOOK D XCPRIC_Cust E DS ExtName(DMCUSMST)
D XCPRIC_Item E DS ExtName(DMITMMST)
D XCPRIC_Inv E DS ExtName(ININFODS) D XCPRIC PR ExtPgm('XCPRIC')
D pCustDS LikeDS(XCPRIC_Cust)
D pItemDS LikeDS(XCPRIC_ItemDS)
D pInvDS LikeDS(XCPRIC_InvDS)That way, when you /COPY this member into your programs:
a) it'll always use the same definitions
b) You won't having naming conflicts (since other programs presumably
won't be called XCPRIC) c) The /define logic prevents the copybook from coming in more than
once (even if the copybook is /copy-ed into another copybook!)The following code duplicates the subprocedures:
/FREE
CustDS = pCustDS;
ItemDS = pItemDS;
InvDS = pInvDS;
Instead, just reference the contents of the parameters directly:
pCustDs.Name = whatever;
pCustDs.Addr = whatever;
pCustDs.Terms = 'NET/30';When you do it that way, there's no reason to copy them back & forth.
Some of the subfields in InvDS are updated. Will this work?
Just my opinion, of course.
This mailing list archive is Copyright 1997-2026 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.