Return Number of Parameters (%PARMS) Built-In Function %PARMS returns the number of parameters passed to the procedure where %PARMS is run. This BIF is useful when the procedure contains multiple optional parameters and if the procedure is called from different places with different number of parameters to identify the number of parameters passed. This is most commonly used to to handle the procedure logic based on the parameters passed only. Value returned by %PARMS is same as *PARMS in Program Status Data Structure if used in the main procedure. Let's have a look at the simple example to see how this works. In the above example, Lines - 5 to 9: Prototype declaration of the Sub procedure with one mandatory parameter, two optional parameters and one return value. We will see the code of procedure in a bit. Line - 18, 22 & 26: Calling the sub procedure with one mandatory parameter, two parameters and three parameters respectively. Let's...
Code with PR - Technical tips on coding and more...