NET/MASTER Network Control Language (NCL) Reference Manual
GOTO
Core Statements
106126 Tandem Computers Incorporated 2–29
A GOTO statement out of an ON block causes that ON block to be terminated. It
also terminates any intermediate procedure or function that called the procedure
or function that established the ON block. This can include other established and
activated ON blocks. It might not be possible to determine, when the procedure is
compiled, the exact number of ON blocks that would be released. (The ON core
statement, described later in this section, defines an ON block.)
The &SYS.LOOPCTL system variable has a default setting of 1000; this value
decrements by 1 each time a GOTO statement is executed. For a detailed
discussion of system variables, see Section 5, “System Variables.” When the
variable reaches 0 (zero), NCL terminates the process. This prevents NCL
processes from uncontrolled recursive looping. You can check the value of
&SYS.LOOPCTL, and if necessary, alter its default initial value by using an
assignment statement.
See also DO and GOSUB. The description of the DO core statement discusses how
the GOTO statement affects nesting levels within DO groups. This description
also refers to the correct use of the GOTO statement within a DO group. The
description of the GOSUB core statement discusses what happens if you code a
GOTO core statement within a subroutine.
Examples
In the following example, the procedure branches to the statement labeled LABEL1:
GOTO LABEL1
The following example goes to the label determined by the value of the &LABEL
variable. If &LABEL contains the value X1 or X2, the GOTO statement is a
multidirectional branch. If the label is not found before the END label, execution
continues from the statement after the failed GOTO statement:
GOTO &LABEL LIMIT END
/* not found falls through */
…
/* not-found processing */
…
GOTO END
X1:
statement …
GOTO END
…
X2:
statement …
GOTO END
/* more NCL statements */
END: