NET/MASTER Network Control Language (NCL) Reference Manual

EXIT
Core Statements
106126 Tandem Computers Incorporated 2–17
EXIT The EXIT core statement ends the current procedure and returns control to the caller.
EXIT also terminates all DO, GOSUB, and ON nesting for the calling procedure.
You can use the EXIT statement to return a value to the &SYS.RETCODE system
variable.
An exit from an ON block is treated as an exit from the procedure that established the
ON block. This implies that all procedure and function nesting between the
establishing procedure and the active ON block is terminated. In this case,
expression
is evaluated in the executing ON block environment. (The ON core
statement, described later in this section, defines an ON block.)
EXIT [
expression
]
expression
specifies an expression that equates to a number from 0 (zero) through 99. This
value replaces the contents of the &SYS.RETCODE system variable. If no
expression is provided, the value of &SYS.RETCODE is unchanged.
Considerations
See the &SYS.RETCODE system variable in Section 5, “System Variables.”
See RETURN, which provides an alternative to EXIT. The RETURN core
statement (described later in this section) allows you to pass variables back to a
calling procedure; EXIT does not do this.
Example
The following example returns to the caller with the value 20 in &SYS.RETCODE:
EXAMPL: PROCEDURE
&A = 20
CALL CALLEX SHARE &A
SAY "&SYS.RETCODE = " &SYS.RETCODE
CALLEX: PROCEDURE
EXIT &A
END CALLEX
END EXAMPL