Below is the technique I use, where there is only *one* source member in
QRPGLESRC, that of the service program, including prototype and code.
No additional source member for the prototypes is needed.
I assume that the service program is fairly static after being written
and thus will be compiled infrequently, but will be bound to other
program more frequently.
So,those doing the compile and binding to other program do not have to
do anything, except code a /include pointing to the source of the
service program. Their compile will pull in just the prototypes and
ignore everything else, because the compiler directive is not set.
If the service program has to be compiled, then you need a compiler
directive, but that is easy to set up with WDSC (Compile, Work with
Compile commands), or I suppose a user command in PDM. It is also easy
to set up with our source control system, which remembers how the source
should be compiled.
If anyone sees any drawbacks with this technique I'd like to know.
Sam
Sample stripped source of QRPGLESRC/SRV_DATE shown below. Hopefully it
will wrap correctly.
I use /include because there was a problem with the SQL precompiler,
though it is probably fixed by now.
/if defined (CompileSRV_DATE)
h nomain option(*NoDebugIo)
*=====================================================
* To use, include these lines in your program:
* H Bnddir('SRV_DATE')
* /include QRPGLESRC,SRV_DATE
/endif
*=== Prototypes for Exported SRV_DATE routines =======
* (This is copied into the user's code )
D MthName3 PR 3a
D InMth 2p 0 Const
D MthName PR 9a varying
D InMth 2p 0 Const
D GetDOW PR 1P 0
D InDate d Const DatFmt(*ISO)
D DayName PR 9a varying
D InDay 1p 0 Const
*=== End of Prototypes for Exported SRV_DATE routines
/if not defined (CompileSRV_DATE)
/eof
/endif
P MthName3 B export
D PI 3
D InMth 2p 0 Const
D wkMth s like(MthName3)
/free
monitor;
wkMth = G_MonthNames3(InMth);
on-error;
wkMth=%char(InMth);
endmon;
return wkMth;
/end-free
P MthName3 E
On 6/30/2011 11:22 AM, BButterworth@xxxxxxxxxxxxxx wrote:
Another option is that with the use of compiler directives, you can copy
the prototypes out of your module source without the use of an additional
copybook member like so:
As an Amazon Associate we earn from qualifying purchases.