NET/MASTER Network Control Language (NCL) Programmer's Guide
Writing an Error Handler
Run-Time Error Handling
106160 Tandem Computers Incorporated 7–11
Recovering From the Error If you do not specify how to recover from an error or explicitly use the FLUSH core
statement, NCL terminates execution of the NCL process. After you detect an error,
however, you may want to attempt to recover from the error and continue execution.
There are two core statements that allow you to attempt to recover from an error:
RESUME and RETRY.
Using the RESUME Core Statement to Recover From an Error
The RESUME core statement leaves an error handler and continues execution from the
statement following the one that raised the error condition. The following example
uses a DO loop to pause an NCL process, obtain a number that is used as the
denominator to divide 100, and display the results of the division:
zex0706n: PROCEDURE
/* Using RESUME to recover from an error */
ON ERROR DO
SAY &1" is an invalid denominator"
SAY Please try again
RESUME
END
DO UNTIL &1 = ZZZZZ
SAY "Divide 100 by what number?"
SAY "Please enter ZZZZZ or a number"
CMDLINE "GO ID="&SYS.NCLID _
PAUSE VARS=&1
IF &1 = ZZZZZ THEN ITERATE
SAY "100 divided by "&1" is "100/&1
END /*do*/
SAY You have entered ZZZZZ
SAY Normal termination
END zex0706n
If you enter an invalid denominator, an error handler displays an error message, asks
you to try again, and resumes execution from the statement following the one raising
the error.
The line that can raise the ON condition in this example is the following:
SAY "100 divided by "&1" is "100/&1
The following line in this example is:
END /*do*/
Entering ZZZZZ rather than a number terminates execution of the NCL process
normally.