On 03/12/2009, at 3:24 PM, Dennis Lovelady wrote:
I have a number of CL (not CLLE) programs that accept up to N
parameters,
but to which I pass less than N under certain circumstances. The
program
can determine whether "more" parameters are needed by the values in
the
supplied data. I don't recommend this approach because the
maintainer can
be easily confused, but I can say that it does work.
For that to work you must be either:
o Patching the CL *PGM object to accept 0 to N parameters (which is
cheating).
or
o All these CL programs are called as command processing programs in
which case the correct number of parameters is being passed by the
Command Analyzer. Blanks, zeroes, or null pointers are passed as
appropriate.
Given a CL program that accepts N parameters, then:
CALL CL from the command line with less than N parameters results in
CPD0172 and CPF0001
Calling from RPG III with less than N parameters results in MCH0802
and CPF9999 and RPG0202.
Calling from RPG IV with less than N parameters results in MCH0802
and CPF9999 and RNQ0202.
Calling from C with less than N parameters results in MCH0802 and
CEE9901.
I presume similar result occur with other languages but haven't checked.
If you mean something else then show me an example.
Also, a MONMSG MCH3601 (I think it is) will handle the case where an
unpassed parameter is referenced. Though that's a significant hit on
performance and joblog size. Don't do it. (But you can, and that's
the
point I wanted to make.)
Only when a command definition object is used as the front-end for a
RTVxxx type command. In this case the Command Analyzer passes a null
pointer for any omitted variables which is not the same thing as
supporting optional parameters. The only way to deal with these in CL
is to monitor for the exception (which is indeed MCH3601), remove the
message from the job log, and skip the parameter.
Regards,
Simon Coulter.
--------------------------------------------------------------------
FlyByNight Software OS/400, i5/OS Technical Specialists
http://www.flybynight.com.au/
Phone: +61 2 6657 8251 Mobile: +61 0411 091 400 /"\
Fax: +61 2 6657 8251 \ /
X
ASCII Ribbon campaign against HTML E-Mail / \
--------------------------------------------------------------------
As an Amazon Associate we earn from qualifying purchases.