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

Explicit Branching
Controlling Execution Flow
5–40 106160 Tandem Computers Incorporated
If NCL does not find a matching label, its action depends on the type of label it is. If
the label is a constant, an error is raised during compilation. If the label is an
expression, the GOTO, GOSUB, or SIGNAL LABEL statement is treated as a NOP core
statement (the NOP statement performs no action). Execution continues with the
statement after the GOTO, GOSUB, or SIGNAL LABEL statement.
Limiting a Search—the GOTO and GOSUB Statements
The LIMIT keyword restricts a GOTO or GOSUB label search. If a label search does
not find the target label by the time the search has compared the LIMIT label, the
target label is treated as though it is not found. Control passes to the statement after
the GOTO or GOSUB statement.
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 with the same name as the target
label elsewhere in the procedure or function.
If you specify the LIMIT keyword, then the label following the GOTO or GOSUB
keyword can be any expression, and the label following the LIMIT keyword must be
an expression that evaluates to a constant during the compilation of the NCL
procedure.
The following two GOSUB statements are correct because each expression following
the LIMIT keyword evaluates to a constant during compilation:
GOSUB task&taskno LIMIT task3
GOSUB task&taskno LIMIT t||a||s||k||3
The constant to which each expression evaluates during compilation is task3.
The following GOSUB statement is incorrect and produces a compilation error because
the expression following the LIMIT keyword does not evaluate to a constant during
compilation:
GOSUB task&taskno LIMIT task||&1
The value of the expression depends on the value of &1, which is determined during
the execution of the NCL process.
Refer to the discussion on expressions and operations in the NonStop NET/MASTER
NCL Reference Manual for more information on expression evaluation during
compilation.
Hint To improve the performance of an NCL process, use the LIMIT keyword to reduce the number of labels
through which to search.