NET/MASTER Network Control Language (NCL) Programmer's Guide

Passing Parameters to Procedures and Functions
Procedures and Functions
106160 Tandem Computers Incorporated 6–19
The following screen shows the results of executing the procedure:
(09:57) --------------------- OPERATOR CONTROL SERVICES ----------------------
START ZEX0610N John Smith
Top level
&1 is John
&2 is Smith
Value of &SYS.PARMCNT is 2
Value of &SYS.ALLPARMS is John Smith
First level
&1 is One
&2 is Two
&3 is Three
Value of &SYS.PARMCNT is 3
Value of &SYS.ALLPARMS is John Smith
Top level
&1 is Gold
&2 is Silver
&3 is Three
Value of &SYS.PARMCNT is 2
Value of &SYS.ALLPARMS is John Smith
NNM1005 START ZEX0610N PROCESSING COMPLETE. NCLID 001023
_____________________________________________________________________________
---------- ------------------ NonStop NET/MASTER D30 ---------------- --------
M=>
The START command passes two parameters to the top-level procedure, John and
Smith, which are placed in two parameter variables, &1 and &2. The top-level
procedure calls the first-level procedure passing three parameters, One, Two, and
Three. The first two parameters, One and Two, overwrite the existing values of &1
and &2. The first-level procedure assigns two new values, Gold and Silver, to &1 and
&2 but leaves &3 unchanged. The final values of &1, &2, and &3 are Gold, Silver, and
Three.
The System Variables
&SYS.PARMCNT and
&SYS.ALLPARMS
The preceding example also illustrates the use of the system variables
&SYS.PARMCNT and &SYS.ALLPARMS. The system variable &SYS.PARMCNT
holds the number of parameters created by an NCL process. The system variable
&SYS.ALLPARMS holds the original parameter string passed to an NCL procedure
executed with a START or EXEC command or the START verb.
When the procedure in the preceding example is executed with the START command
and the top-level procedure is executed, the value of &SYS.PARMCNT is 2 because
two parameters (&1 and &2) are created. When the first-level procedure is called with
the CALL core statement, the value of &SYS.PARMCNT is 3 because three new
parameters (&1, &2, and &3) are created. When the first-level ends, the value of
&SYS.PARMCNT is 2 again. This represents the number of parameters originally
passed to the procedure by the START command.
If a procedure is called by the START or EXEC command or the START verb, and
parameters are passed to it, the complete parameter string is available in the system
variable &SYS.ALLPARMS. In the preceding example, the value of &SYS.ALLPARMS
does not change throughout the execution because only one START command is
executed.