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

The Structure of an NCL Procedure
Initial NCL Procedure Development
4–10 106160 Tandem Computers Incorporated
The following example shows an NCL procedure that uses many of the core
statements that can use labels:
zex0402n: PROCEDURE
/* Procedure containing many labels */
SIGNAL_LABEL:
&a = 21
DO_UNTIL_LABEL:
DO UNTIL ( &a = 0 )
&a = &a - 1
IF even_func_label( &a ) THEN ITERATE do_until_label
SAY &a is an odd number
GOSUB gosub_label
IF &a = 11 THEN LEAVE do_until_label
END do_until_label
EXIT
GOSUB_LABEL:
GOTO goto_label_&a
IF &signal_label_used = yes THEN,
RETSUB
ELSE DO
&signal_label_used = yes
SIGNAL label signal_label
END /*do*/
GOTO_LABEL_19:
RETSUB
GOTO_LABEL_15:
GOTO_LABEL_13:
GOTO_LABEL_11:
SAY "... and only appears once!"
RETSUB
even_func_label: FUNCTION
&rem = &1 % 2
RETURN ( NOT(&rem) )
END even_func_label
END zex0402n
The procedure attempts to count down from number 21 to number 0 using a DO loop.
It checks to see if certain numbers—20 through 11—are odd or even and reports the
results.