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

Explicit Branching
Controlling Execution Flow
106160 Tandem Computers Incorporated 5–37
The SIGNAL LABEL
Statement
The SIGNAL LABEL core statement transfers execution control to the specified label.
The target label is the one that follows the LABEL keyword. You cannot use the
SIGNAL LABEL statement to transfer control to a label in an inactive block of
statements, for example, a DO group or a DO loop where the opening DO statement
has not been executed. The target label can be a constant or an expression.
The SIGNAL LABEL core statement terminates all active DO loops and open
subroutines in the current procedure or function. It releases any blocks of statements
established by a previously executed ON core statement.
Note Do not confuse the SIGNAL LABEL core statement with the SIGNAL core statement. The former targets
a label. The latter signals an error condition. The SIGNAL statement is discussed in Section 7,
“Run-Time Error Handling.”
The following example shows an NCL procedure that uses the SIGNAL LABEL
statement:
zex0525n: PROCEDURE
/* SIGNAL LABEL statement */
&error = &1
GOTO start_proc
error_label:
SAY Do error processing
SAY Exit procedure after error processing
EXIT
start_proc:
SAY Begin procedure
IF &error = Y THEN
SIGNAL LABEL error_label
ELSE
SAY Exit procedure normally
END zex0525n
The procedure uses the SIGNAL LABEL statement to explicitly signal an error
condition if the value of the variable &ERROR is Y and jump to a target label. If the
value of &ERROR is not Y, the SIGNAL LABEL statement is not executed. The value
of the parameter &1, which is passed to the procedure when it is executed, determines
the value of &ERROR. (Parameters are discussed in detail in Section 6, “Procedures
and Functions.”)
Note The GOTO core statement is used in this procedure to simply emphasize the flow of control of the
SIGNAL LABEL statement. The GOTO statement targets a label in the middle of the SIGNAL procedure
to show that the SIGNAL LABEL statement can find a target label at the beginning of the procedure. Use
of the GOTO core statement is not recommended.