|
Remember that the prototype for your program should be in a /COPY file,
and that you should copy it into both the calling program and the called
program.
Here's one way to handle a /copy file that has a prototype with a file
parameter. (I know that all the /define and /undefine directives are
ugly, but they're not nearly as ugly as trying to debug problems caused
by having the file and prototype defined in two different places.)
/COPY file MYTESTCPY:
/if defined(fspecs)
FTrctCnt_t if e k disk template block(*No)
F extdesc('TRCTCONT')
F Qualified
/endif
/if defined(dspecs)
DMytest1 pr extpgm('MyTest1')
D Parm1 LikeFile(TrctCnt_t)
/endif
Program A, the calling program that actually defines the file, has to
copy in the /copy file twice, once to get the F specs and once to get
the D specs.
/define fspecs
/copy mytestcpy
/undefine fspecs
FTrctCont Likefile(TrctCnt_t)
F extfile(*extdesc)
/define dspecs
/copy mytestcpy
/Free
Callp MYTEST1(TrctCont);
*Inlr = *On;
/End-Free
Program B, the called program that actually defines the file. It doesn't
have any F specs of its own, so it only needs one /COPY
/define fspecs
/define dspecs
/copy mytestcpy
DMyTest1 pi
D Parm1 LikeFile(TrctCnt_t)
DMyVal1 s 1n
D ds ds Likerec(Parm1.fmt1)
/Free
read Parm1 ds;
If ds.emlrdt = 0;
MyVal1 = *On;
Endif;
*Inlr = *On;
/End-Free
--
Barbara
--
This is the RPG programming on the IBM i (AS/400 and 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.