NET/MASTER Network Control Language (NCL) Programmer's Guide
Single and Repetitive Execution
Controlling Execution Flow
106160 Tandem Computers Incorporated 5–5
Using a Variable Expression. If the expression following the DO keyword is a variable,
the DO loop executes the number of times specified by the variable.
The following example shows an NCL procedure that uses a variable expression in a
DO loop:
zex0503n: PROCEDURE
/* Variable expression in a DO loop */
DO &1
SAY COPIES("*",(2 * &1))
END
END zex0503n
This procedure draws a rectangle on the screen. You specify the height as a parameter
following the START command. The value of the height is assigned to the parameter
variable &1. The procedure uses the parameter to determine the number of times to
execute the DO loop that draws the rectangle.
The following screen shows the results of executing the procedure twice:
(06:29) --------------------- OPERATOR CONTROL SERVICES ----------------------
START ZEX0503N 2
****
****
NNM1005 START ZEX0503N PROCESSING COMPLETE. NCLID 025003
START ZEX0503N 9
******************
******************
******************
******************
******************
******************
******************
******************
******************
NNM1005 START ZEX0503N PROCESSING COMPLETE. NCLID 025004
_____________________________________________________________________________
---------- ------------------ NonStop NET/MASTER D30 ---------------- --------
M=>
When executed first, the value of the parameter &1 passed to the procedure is 2; the
first rectangle drawn has a height of two lines. When executed second, the value of
the parameter &1 is 9; the second rectangle drawn has a height of nine lines.