NET/MASTER Network Control Language (NCL) Reference Manual

GOTO
Core Statements
106126 Tandem Computers Incorporated 2–27
GOTO The GOTO core statement unconditionally transfers control to a label within a
procedure or function. Execution restarts at a user-specified label.
GOTO
label
[ LIMIT
limit-expr
]
[ MATCH { EQ | GE | GT | LE | LT | NE } ]
label
specifies a label.
label
must be a constant label or an expression that equates to a
legal label name without the trailing colon (:). The GOTO statement cannot see
PROCEDURE or FUNCTION labels, or labels within inner, outer, or nested
procedures or functions.
See Section 8, “Compiler Operation,” for the definition of valid NCL labels.
The label must not be in an inactive block—for example, a DO group in which the
opening DO statement has not been executed. Constant labels are checked when
the code is compiled, while labels defined as expressions are checked when the
procedure is executed.
If the label is outside the current innermost active block, all blocks nested within
the target block are terminated.
The search for the label starts at the next statement. If you code the label in
lowercase letters, NCL converts it to uppercase before the search.
If NCL reaches the end of the procedure before it finds the label, the search restarts
at the beginning of the procedure and continues until the current GOTO statement
is located.
The type of label determines what happens if the label is not found. If the label is
a constant, NCL issues an error message during compilation. If the label is an
expression, NCL treats the GOTO statement as a NOP core statement that
performs no action.
You can use LIMIT as a label; NCL does not confuse this with the LIMIT keyword.
LIMIT
limit-expr
specifies a constant label, or an expression that equates to a label and that restricts
the search to the first label that matches the value of
limit
-
expr
.
You can use the LIMIT keyword to stop an unsuccessful search from reaching the
end of a procedure or function or wrapping around to the beginning of a
procedure or function. This stops a search from finding a label that precedes the
GOTO statement in the procedure or function. If you specify the LIMIT keyword,
limit-expr
must either be a constant or an expression that equates to a constant.
If no label in the NCL procedure matches the value of
limit-expr
, a compilation
error results.