NET/MASTER Network Control Language (NCL) Programmer's Guide
Terminating Execution of the Current Procedure or Function
Procedures and Functions
6–14 106160 Tandem Computers Incorporated
The EXIT Statement—
Procedures Only
The EXIT core statement terminates the execution of a procedure. You cannot use it to
terminate the execution of a function.
When you exit, you terminate execution of the current procedure. The EXIT statement
returns from the current procedure to the procedure or function that called it.
The EXIT statement can set a return code in &SYS.RETCODE. You can use this value
to test how a procedure terminated.
The following example shows an NCL procedure that uses the EXIT core statement to
terminate execution and set a return code:
zex0607n: PROCEDURE
/* Uses EXIT and &SYS.RETCODE */
SAY Top level
SAY "Value of &SYS.RETCODE is "&SYS.RETCODE
CALL first_level
first_level: PROCEDURE
SAY First level
EXIT 77 /* Return code */
END first_level
SAY Top level
SAY "Value of &SYS.RETCODE is "&SYS.RETCODE
END zex0607n
The first-level procedure uses the EXIT statement to terminate execution. EXIT passes
back a return code of to the top-level procedure. The value of the return code (77) is
placed in the system variable &SYS.RETCODE. The final SAY statement displays the
value of &SYS.RETCODE.
The following screen shows the results of executing the procedure:
(09:07) --------------------- OPERATOR CONTROL SERVICES ----------------------
START ZEX0607N
Top level
Value of &SYS.RETCODE is 0
First level
Top level
Value of &SYS.RETCODE is 77
NNM1005 START ZEX0607N PROCESSING COMPLETE. NCLID 001009
_____________________________________________________________________________
---------- ------------------ NonStop NET/MASTER D30 ---------------- --------
M=>