Hi, Scott:

This may be fine for CL programs that are called from a command line, but what about CL programs that are CALLed by many other programs, many of which may not be CL themselves? e.g. RPG/400, RPG IV, COBOL, etc.? :-\

Always using a *CMD front-end would necessitate using an API like QCMDEXC from within RPG or COBOL or C and concatenating the "command string" to pass to the API ... That seems like a lot of work and overhead, just for some "optional parameter" handling ... :-P

The underlying MI architecture (both OPM and ILE) supports passing a variable number of arguments, and detecting the number of parameters actually passed ... in OPM MI, this is accomplished using the STPLLEN instruction.

The ILE RPG IV language has supported a "%parms" BIF for some years now ...

I think what is really needed is for several of the good folks on this list to open a DCR with IBM to request a %parms BIF be added to CL.

All the best,

Mark S. Waterbury

> On 1/27/2014 12:16 PM, Scott Klement wrote:
Use a *CMD front-end. This is the proper way to have optional
parameters in the CL environment. With this, you can add new parameters
as you need without breaking anything.

So you'll have:

1) New program with old name for backward compatibility. It calls the
original program (with new parameters and logic added) as a command.

2) The *CMD interface.

3) The original program, now with a new name and the additional logic.
It is always called via the *CMD interface (#2) and can either be called
from #1, or called directly via the *CMD interface from any new programs.

When you want to add additional parameters down the road, you add them
to the *CMD interface as well as the CL program. The *CMD can take care
of passing default values or *null addreses for parameters that are unused.

Return to Archive home page | Return to MIDRANGE.COM home page