NET/MASTER Network Control Language (NCL) Reference Manual
RETSUB
Core Statements
106126 Tandem Computers Incorporated 2–53
RETSUB The RETSUB core statement returns to the statement after the most recently executed
GOSUB statement in a procedure. A RETSUB deactivates any DO group opened since
the most recently executed GOSUB statement. It does not replace the END statement
of a DO group.
A RETSUB statement also reinstates DO group nesting, active at the time of the
GOSUB statement. If no GOSUB statement is active when RETSUB is issued, a
run-time error results.
The RETSUB statement deletes any error condition handlers established by ON
statements since the most recently executed GOSUB statement.
RETSUB [
num-expr
]
num-expr
specifies an expression (which can be a variable) that is a number in the range 0
(zero) through 99. This value is placed in the &SYS.RETCODE system variable. If
the expression is omitted, &SYS.RETCODE is not altered.
Considerations
If you issue a RETSUB statement from within an ON block, but you performed no
GOSUB statement after the ON block started execution, a search for the most
recently executed GOSUB statement occurs within the establishing environment.
This repeats for all nested ON block executions. The action of finding the most
recently executed GOSUB statement terminates all intermediate procedure,
function, or ON block environments. (The ON core statement, described earlier in
this section, defines an ON block.)
See also DO and GOSUB. The effect of GOSUB and RETSUB statements in a DO
group is covered in the description of the GOSUB core statement.