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

Single and Repetitive Execution
Controlling Execution Flow
5–10 106160 Tandem Computers Incorporated
Note NCL assumes a positive value of 1 for the increment even when the starting value of the control variable
is greater than the value after the TO keyword. In this case, the loop is not executed.
If the number following the BY keyword is not an integer it may be inaccurate (if it is not exactly
representable in the underlying binary floating point numeric format).
The following example shows an NCL procedure that uses a control variable with the
BY keyword in a DO loop:
zex0506n: PROCEDURE
/* DO loop with the BY keyword */
DO &control = 10 TO 6 BY -2
SAY &control
END
SAY "The final value of &control is "&control
END zex0506n
The initial value of the control variable, &CONTROL, is 10. The value of &CONTROL
is decremented by 2 at each pass through the loop. The terminating value is 6. The
final value of &CONTROL is 4.
The following screen shows the results of executing the procedure:
(10:42) --------------------- OPERATOR CONTROL SERVICES ----------------------
START ZEX0506N
10
8
6
The final value of &control is 4
NNM1005 START ZEX0506N PROCESSING COMPLETE. NCLID 003003
_____________________________________________________________________________
---------- ------------------ NonStop NET/MASTER D30 ---------------- --------
M=>