%PARMNUM returns the number of the parameter in the parameter list. The operand for %PARMNUM is the name of a parameter defined as part of a procedure interface.
For more information, see Built-in Functions.
D myProc pi 10A RTNPARM OPDESC
D companyName 25A OPTIONS(*VARSIZE)
D errorCode 1A OPTIONS(*OMIT)
D cityName 25A OPTIONS(*NOPASS)
/free
// test the length of companyName
callp CEEDOD(%parmnum(companyName) : more parameters ...
: parmlen : *omit);
if parmlen < 25;
// the full parameter was not passed
endif;
// test the presence of the omissible errorCode parameter
callp CEETSTA(isPresent : %parmnum(errorCode) : *omit);
if isPresent = 1;
// errorCode was not omitted
endif;
// test the presence of the optional city parameter
if %parms >= %parmnum(cityName);
// cityName was passed
endif;