%PARMS built-in function returns the number of procedure parameters that were received inside of a BEGPROC procedure.
%PARMS
To support Procedure parameters, the DclSrParm command has an OPTIONS keyword. It is only valid in BegProc subroutines, and it may contain *OMIT and/or *NOPASS. Please see DclSrParm for further information.
Use the %OMITTED function to know whether a parameter defined with Options (*OMIT) contains a valid value.
Note %PARMS and %IsOmitted functions are only valid inside a BEGPROC procedure. Also, %IsOmitted is only valid on parameters that have the *Omit option.
BegProc *ENTRY Access(*Public)
DclSrParm CustName
DclSrParm CustAddress
DclSrParm CustPhone Options(*NoPass)
. . .
// Get the Phone Number
If (%Parms = 3)
// if we are here, it means that CustPhone was passed
EndIf
. . .
EndProc
// Check the Location of a Customer
BegProc CheckLocation Access(*Public)
DclSrParm CustZip Options(*Omit)
DclSrParm CustState Options(*Omit, *NoPass)
. . .
// Get the Zip Code
If not %OMITTED(CustZip)
// we have a valid zip code
EndIf
// Get the State
If(%Parms=2)
// if we are here, CustState was passed, but it may be omitted
If not %OMITTED(CustState)
// we have a valid State
EndIf
EndIf
. . .
EndProc
Built-in Function Overview
%OMITTED Function
BEGPROC
DCLSRPARM