On 17-Apr-2012 03:00 , Gavin Fung wrote:

I'm doing some RPG programs' development and I found that some of
these RPG require more input parameters from their caller (e.g. a CL
program), I feel confuse that they still working even the number of
the parameters are not match, for example, RPG A has 5 input
parameter and its caller CL B only gives it 3.

RPG A:
*ENTRY PLIST
PARM P1
PARM P2
PARM P3
PARM P4
PARM P5

CLP B:
CALL A (&P1 &P2 &P3)

And it seems only work inside the programs, I fail to call RPG-A with
3 parameter in command line mode.

Compiled as an ILE bound RPG program, the *PGM as viewed by DSPPGM presumably would show the following under the "Program statistics:" section:
Number of parameters . . .. . : 0 255

Compiled as an OPM RPG program, the *PGM as viewed by DSPPGM presumably would show the following under the "Program statistics:" section:
Number of parameters . . .. . : 0 5

That suggests a CL [command line] CALL can invoke the RPG program with anywhere from zero up to either five or 255 parameters, and not receive a MCH0802 which actually would be diagnosed by CPD0172 and CPF0001. In either case, the onus is on the called program to ensure the correct\required minimum number of parameters were actually passed; e.g. using %PARMS (Return Number of Parameters). And if the called program [called via the quoted CL CALL with three parameters] does not refer to the fourth and fifth parameters, then the called program will not fail with either MCH0801 as diagnosed by RPG0221 or [most likely] MCH3601 as diagnosed by RNQ0222.

FWiW an MI OPM program can be defined with a MIN(2) on its parameter list declaration to indicate that its ENTRY [point] specification requires a minimum of two parameters. I was surprised that I could find a similar capability for the PLIST of RPG.

Regards, Chuck

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2019 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].