|
"M. Lazarus" wrote: > > Barbara, > > At 3/24/03 06:35 PM, you wrote: > >Mark, prototypes are meant to be used by both calling programs and the > >program itself (so for EXTPGM, the prototype should be in a /copy > >file). The EXTPGM keyword is really more for the callers anyway, so I > >think it should be hardcoded. For the program itself, if the command's > >PGM parameter and the EXTPGM parameter are different you just get a sev > >10 message; the EXTPGM parm is ignored and the program gets created > >exactly the same as if you had the EXTPGM correct. > > I've been thinking about this (and using /COPY in my programs) and have > come to the conclusion that I'd still like to have the > EXTPGM(*CURRENT). Here's why. I've found that the best compromise between > flexibility and simplicity is coding like this: > > D MyPgm PR EXTPGM( 'MyRealPgm' ) > /COPY MyRealPgm@ > > D MyPgm PI > /COPY MyRealPgm@ > > where MyRealPgm@ contains the fields and parm attributes. This keeps the > fields in sync, but avoids having to define conditional compiler directives > to make sure the specific lines (PR vs. PI) get included. It also helps > readability, IMHO, when trying to figure out definitively which procedure > is being called. > > Having EXTPGM(*CURRENT) would document that this is really a replacement > for *ENTRY PLIST. Am I missing something major here? > Mark, if 'MyRealPgm' isn't the name of your program, how will the callers find it? Maybe I'm missing something. The presense of the PI should be documentation enough that this is the entry parameters for whatever procedure it's coded in. "*CURRENT" won't help anyone who's scanning for "*ENTRY" to find the entry parms. If you want to put your parms in a /copy file, do this for your prototype copy file: D MyPgm PR EXTPGM( 'MyRealPgm' ) /COPY MyRealPgm@ and your main source has D MyPgm PI /COPY MyRealPgm@ If you frequently change the names of your programs, you could code the names as named constants and copy the named constants file into all your programs. D EXT_MYREALPGM C 'XY01S833' D EXT_MYPGM2 C 'XY02S833' /COPY EXTPGMNAME D MyPgm PR EXTPGM(EXT_MYREALPGM)
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.