LPIPARAMCOUNT Function

Purpose

Returns a fixed binary(15) integer that represents the number of parameters passed to a PL/I subroutine.

Syntax

LPIPARAMCOUNT()

or

LPIPARAMCOUNT

Description

The LPIPARAMCOUNT built-in function returns the number of parameters passed to an Open PL/I procedure from another PL/I procedure. To be able to use this function, the calling procedure has to be compiled with the -paramount compile time option, or that procedure has to have an entry name attribute OPTIONS(LPIPARAMCOUNT).

Examples

main: procedure options(main);
declare subr entry;
...
call subr();
...
call subr(x,y,z);
end main;

subr: procedure(p1,p2,p3,p4);
...
declare no_of_args fixed bin(15);
no_of_args = lpiparamcount();
put skip list ('Number of arguments passed to SUBR:  ',
                no_of_args);
end subr;

If the main program is compiled with the -paramcount option, the above example will print:

Number of arguments passed to SUBR: 0
Number of arguments passed to SUBR: 3

Restrictions

None.