NET/MASTER Network Control Language (NCL) Programmer's Guide
Explicit Branching
Controlling Execution Flow
5–38 106160 Tandem Computers Incorporated
The following screen shows the results of executing the procedure twice:
(12:34) --------------------- OPERATOR CONTROL SERVICES ----------------------
START ZEX0525N
Begin procedure
Exit procedure normally
NNM1005 START ZEX0525N PROCESSING COMPLETE. NCLID 002022
START ZEX0525N Y
Begin procedure
Do error processing
Exit procedure after error processing
NNM1005 START ZEX0525N PROCESSING COMPLETE. NCLID 002023
_____________________________________________________________________________
---------- ------------------ NonStop NET/MASTER D30 ---------------- --------
M=>
When the procedure is executed for the first time, it terminates execution normally—it
does not execute the SIGNAL LABEL statement because the value of &ERROR is not
Y. When the procedure is executed for the second time, the value of the variable
&ERROR is Y and so the SIGNAL LABEL statement is executed.
The GOTO Statement The GOTO core statement unconditionally transfers control to a target label in a
procedure or function. The target label is the one that follows the GOTO keyword.
You cannot use the GOTO 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 following example uses the GOTO statement to jump directly to the
TARGET_LABEL: label when the value of &ERROR is Y:
zex0526n: PROCEDURE
…
IF &error = Y THEN
GOTO target_label /* GOTO statement */
…
target_label: /* Target label */
…
END zex0526n
Note Use of the GOTO core statement is not recommended in NCL procedures and functions, since its use
detracts from structured programming techniques.