NET/MASTER Network Control Language (NCL) Reference Manual

DO
Core Statements
2–12 106126 Tandem Computers Incorporated
exprr
specifies a value containing the number of times you want the DO group to
execute.
exprr
must be zero or a positive integer. If
exprr
starts with a
variable name followed by an equal sign (=), the first control variable format is
assumed unless you enclose the expression in parentheses ().
conditional
executes a DO group under the control of one or more conditional expressions.
NCL can test these expressions before or after each DO loop, or both.
WHILE
exprw
[ UNTIL
expru
]
specifies an expression that is tested before each iteration starts.
exprw
must
be either true (1) or false (0). The DO group repeats while
exprw
remains true
or, optionally, until
expru
becomes true. If, on entry to the DO group,
exprw
is false, the DO group terminates immediately.
UNTIL
expru
[ WHILE
exprw
]
specifies an expression that is tested after each iteration ends.
expru
must be
either true (1) or false (0). The DO group repeats until
expru
becomes true or,
optionally, while
exprw
remains true. If, after executing the DO group,
expru
is true, the DO group terminates immediately.
statement(s)
specifies any NCL statement or statements.
END [
label
]
ends the specified DO group. If
label
was specified for the DO statement, the
closing END statement must have the same
label
reference (omitting the colon
(:)). This allows the compiler to check DO/END statement pairing for correct
nesting consistency.
Considerations
NCL gets a compilation error if you execute a GOTO statement to a label within an
inactive DO group.
When a GOTO core statement is executed and the target statement is not within
the innermost active DO statement range, the groups represented by the
intermediate DO statements are terminated.
A GOSUB core statement inside a DO group records the current DO nesting status
and then clears it. A RETSUB core statement releases all active DO statements
(started since the GOSUB statement) and then restores the recorded DO nesting
status, before finally returning to the statement after the GOSUB statement.