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

Explicit Branching
Controlling Execution Flow
106160 Tandem Computers Incorporated 5–35
The following screen shows the results of executing the procedure:
(12:24) --------------------- OPERATOR CONTROL SERVICES ----------------------
START ZEX0523N
Enter size of rectangle (3-15)
|NM1060 PROCEDURE ZEX0523N NCLID 2018 PAUSED
ABC is rubbish
Enter size of rectangle (3-15)
|NM1060 PROCEDURE ZEX0523N NCLID 2018 PAUSED
1 is too small
Enter size of rectangle (3-15)
|NM1060 PROCEDURE ZEX0523N NCLID 2018 PAUSED
16 is too big
Enter size of rectangle (3-15)
|NM1060 PROCEDURE ZEX0523N NCLID 2018 PAUSED
5 is valid
**********
**********
**********
**********
**********
NNM1005 START ZEX0523N PROCESSING COMPLETE. NCLID 002018
_____________________________________________________________________________
---------- ------------------ NonStop NET/MASTER D30 ---------------- --------
M=>
The values entered are ABC (incorrectly), 1 (too small), 16 (too big), and 5 (valid).
Explicit Branching The core statements that control explicit branching from one point in a procedure or
function to another are listed here in order of discussion:
GOSUB and RETSUB
SIGNAL LABEL
GOTO
The GOSUB and RETSUB
Statements
The GOSUB core statement transfers execution control to a target label at the
beginning of a subroutine in a procedure or function. The target label is the one that
follows the GOSUB keyword. You cannot use the GOSUB 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.
At the end of the subroutine, the RETSUB core statement returns to the statement
following the GOSUB statement. A GOSUB statement must have a corresponding
RETSUB statement. The RETSUB statement can return a return code. The value of the
return code is placed in the system variable &SYS.RETCODE.