NET/MASTER Network Control Language (NCL) Programmer's Guide
Getting Started With Functions
An NCL Tutorial
106160 Tandem Computers Incorporated 3–27
The following screen shows the result of executing the USERW2 NCL procedure three
times in the OCS message display area:
(14:45) --------------------- OPERATOR CONTROL SERVICES ----------------------
START USERW2 5
Cube of 5 is: 125
NNM1005 START USERW2 PROCESSING COMPLETE. NCLID 008503
START USERW2 11
Cube of 11 is: 1331
NNM1005 START USERW2 PROCESSING COMPLETE. NCLID 008504
START USERW2 17
Cube of 17 is: 4913
NNM1005 START USERW2 PROCESSING COMPLETE. NCLID 008505
_____________________________________________________________________________
---------- ------------------ NonStop NET/MASTER D30 ---------------- --------
M=>
Features of USERW2 Here are some of the features of the USERW2 NCL procedure.
The START USERW2 Command
When you execute an NCL procedure by using the START command, you can pass
parameters to it. The START commands used in this example pass the numbers 5, 11,
and 17, respectively, to the USERW2 NCL procedure. In each case the number is the
first (and only) parameter passed and so it is placed in the parameter variable &1.
The Parameter Variable &1
The most instructive thing to notice about USERW2 and CUBE is where each uses the
parameter variable &1. The parameter is first used as a simple variable after the
DATA keyword in the WRITE verb between two quoted strings. It is then used in a
parameter list when the CUBE user-written function is called. Finally, it is used as a
term in an expression in the RETURN statement.
The final result of the CUBE user-written function in this example depends on the
value of the parameter passed to it. If 5 is passed, the result is 125; if 11, 1331; and if
17, 4913. The result in each case is passed back to the WRITE verb, which displays the
value of the parameter and the result of cubing the number in the OCS message
display area.