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

Scope and Error Handling
Run-Time Error Handling
7–20 106160 Tandem Computers Incorporated
This affects how certain core statements operate when they are executed within the
error handler.
It is recommended that you use the RETRY or RESUME core statement to recover from
an error. These statements transfer control from the error handler that is handling the
error back to the procedure or function where the error was raised. Using other
statements to exit from an error handler can prematurely exit every nested NCL
procedure or function and is not recommended. (The term given to the premature
dismantling of a nested environment, NCL procedure, or function is cutting back.)
Scope and Sharing
Variables
Raising an error handler in one NCL procedure or function and passing control to an
error handler in another NCL procedure or function does not have a significant effect
on sharing variables: shared variables are always returned back to the calling
procedure or function regardless of how the callee procedure or function terminates.
However, if variables have been shared to an NCL procedure or function, and the
NCL procedure or function raises an error handler in the calling NCL procedure or
function, the variables are not available to the calling NCL procedure or function while
inside the error handler.
Scope and Releasing an
Error Handler
Scope affects how to release an error handler using the REVERT core statement. You
can use the REVERT statement to release an error handler for a condition, if one is
established in the current block: if one exists, the error handler in the outer block is
reinstated as the current error handler.
In the following example, the REVERT statement releases the ON ERROR error
handler in the function, FUNC. The ON ERROR statement in the procedure, PROC,
becomes the current general error handler.
proc: PROCEDURE
ON ERROR CALL GENERR1
func: FUNCTION
ON ERROR CALL GENERR2
REVERT ERROR /* Releases current error handler */
END func
END proc