NET/MASTER Network Control Language (NCL) Reference Manual
DO
Core Statements
2–10 106126 Tandem Computers Incorporated
DO The DO core statement brings multiple statements together for execution either once,
repeatedly, or not at all. Statements within a DO group form an active group when
they are executing. A DO group is sometimes referred to as a “block.” When a DO
statement begins executing, it is said to “open a block.”
Inner procedure, subroutine, and function definitions are not permitted within DO
groups. This means that GOSUB and CALL target labels are not permitted within
DO groups.
If the DO statement contains no conditional or iterative clauses, the group of
statements (before the closing END statement) is executed once. You can use this form
of grouping within an IF or ELSE statement to execute any number of statements
under each logic path.
Any ON block established within a DO group is deactivated when the DO group
terminates. (The ON core statement, described later in this section, defines an ON
block.) A DO group records the current ON status and reestablishes it when the DO
group terminates. If a DO group establishes a new ON block, this block becomes
active only for any calls made within the DO group.
[
label
:] DO [
repetitor
] [
conditional
]
[
statement(s)
]
END [
label
]
repetitor
is:
control-variable = expri
[ TO
exprt
]
[ BY
exprb
]
[ FOR
exprf
] |
FOREVER |
exprr
conditional
is:
WHILE
exprw
[ UNTIL
expru
] |
UNTIL
expru
[
WHILE
exprw
]
label
specifies a label for the DO group of statements. You can use this label as a target
label. It must be unique within the procedure. An END statement must terminate
the group to allow the compiler to test for correct DO/END pairing and check for
consistency of nesting levels.
label
must not be specified if the DO group of statements is the action clause of
another statement, such as IF or ELSE.
See Section 8, “Compiler Operation,” for the definition of valid NCL labels.