Here's an example of what Jon's talking about:
D PgmToCallName S 21A
D PgmToCall PR Extpgm(PgmToCallName)
D Parm1 10A Const
D Parm1 10A Const
D Parm1 10A Const Options(*Nopass)
PgmToCallName = 'MYLIB/MYPGM';
PgmToCall( 'ABC' : 'DEF' : 'GHI' );
Back to the OP's original question though, the quick answer is that aside
from the various techniques to prototype the call (which will only minimize
the amount of code), you still have to explicitly do the check for the extra
parm. Not a huge problem if you're talking about 1 extra parm, but if there
are lots, then you get something like this:
select:
when %parms > 2;
PgmToCall( Parm1 : Parm2 : Parm3 );
when %parms > 3;
PgmToCall( Parm1 : Parm2 : Parm3 : Parm4 );
when %parms > 4;
PgmToCall( Parm1 : Parm2 : Parm3 : Parm4 : Parm5 );
....
when %parms > 9;
PgmToCall( Parm1 : Parm2 : Parm3 : Parm4 : Parm5 : Parm6:
Parm7: Parm8: Parm9: Parm10 );
endsl;
I've done this to 'wrapper' an internal (unexported) procedure.
Nothing you can do about it.
Rory
On Tue, Aug 18, 2009 at 8:14 AM, Jon Paris <jon.paris@xxxxxxxxxxxxxx> wrote:
Yes you can - simply remove the quotes from the program name on the
EXTPGM and the compiler treats it as a variable just as with the old
CALL/PARM method.
Jon Paris