NET/MASTER Network Control Language (NCL) Programmer's Guide
5 Controlling Execution Flow
106160 Tandem Computers Incorporated 5–1
Controlling execution flow refers to controlling the order in which the statements that
make up an NCL procedure or function are executed. This section discusses the NCL
core statements used to control:
Single and repetitive execution (DO and END; ITERATE; and LEAVE)
Conditional execution (IF; NOP; and SELECT)
Explicit branching (GOSUB and RETSUB; SIGNAL LABEL; and GOTO)
Table 5-1 summarizes the core statements discussed in this section.
Table 5-1. Core Statements Used to Control Execution Flow
Core Statement Description
DO Executes a group of statements once or repetitively.
END Terminates an NCL procedure or function declaration, or ends a SELECT group or
DO group.
GOSUB Calls a subroutine within the current NCL procedure or function.
GOTO Unconditionally transfers control to the statement beginning with the specified
target label within the current NCL procedure or function.
IF Tests an expression and selects one of two execution paths based on the
outcome.
ITERATE Performs the next iteration of a repetitive DO loop.
LEAVE Exits a repetitive DO loop immediately.
NOP Performs no action, acts as a place holder.
RETSUB Returns from a subroutine started with a GOSUB core statement.
SELECT Tests an expression and selects one of multiple execution paths based on the
outcome.
SIGNAL LABEL Transfers control to the statement beginning with the specified target label within
the current NCL procedure or function.
For the complete syntax of core statements, refer to the NonStop NET/MASTER NCL
Reference Manual.