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

The Structure of an NCL Procedure
Initial NCL Procedure Development
4–8 106160 Tandem Computers Incorporated
Some core statements, such as PROCEDURE and FUNCTION, require at least one
label. Keywords such as ELSE and WHEN prohibit labels. Refer to the NonStop
NET/MASTER NCL Reference Manual to check whether a particular statement or
keyword requires or prohibits a label.
You can specify a label on a nested statement. The following example shows a label
after THEN in an IF statement:
IF &a < 0 THEN
label1: DO
SAY a
END label1
ELSE
SAY b
The following example illustrates various ways to target labels in an NCL procedure:
zex0401n: PROCEDURE
/* GOSUB and RETSUB statements */
SAY "Initial value of &SYS.RETCODE is "&SYS.RETCODE
DO &taskno = 1 to 5
GOSUB task&taskno
SAY "Loop "&taskno" &SYS.RETCODE is "&SYS.RETCODE
END
SAY "Final value of &SYS.RETCODE is "&SYS.RETCODE
EXIT
task1:
SAY "Performs task "&taskno
RETSUB &taskno
task2:
task3:
SAY "Performs task "&taskno
RETSUB &taskno
task4:task5:task6:
SAY "Performs task "&taskno
RETSUB &taskno
END zex0401n