NET/MASTER Network Control Language (NCL) Programmer's Guide
Single and Repetitive Execution
Controlling Execution Flow
106160 Tandem Computers Incorporated 5–17
Combining Counters and
Conditional Clauses
You can combine counters and conditional clauses in a DO loop. The syntax of a DO
loop that uses both counters and conditional clauses is the following:
DO
cvar
=
expri
[ TO
exprt
] [ BY
exprb
] [ FOR
exprf
]
[ WHILE
exprw
] [ UNTIL
expru
]
statement1
statement2
statement3
…
END
The following example shows an NCL procedure that uses a DO loop with counters
and a conditional clause:
zex0511n: PROCEDURE
/* DO loop with counters and a conditional clause */
&until = 1
DO &control = 1 BY 0.5 FOR 5 UNTIL &until = 10
SAY "&control is "&control
SAY "&until is "&until
&until = &until + 1
END
SAY "Final value of &control is "&control
SAY "Final value of &until is "&until
END zex0511n
The DO loop tests a variety of conditions.
The following screen shows the results of executing the procedure:
(15:34) --------------------- OPERATOR CONTROL SERVICES ----------------------
START ZEX0511N
&control is 1
&until is 1
&control is 1.5
&until is 2
&control is 2
&until is 3
&control is 2.5
&until is 4
&control is 3
&until is 5
Final value of &control is 3.5
Final value of &until is 6
NNM1005 START ZEX0511N PROCESSING COMPLETE. NCLID 017512
_____________________________________________________________________________
---------- ------------------ NonStop NET/MASTER D30 ---------------- --------
M=>