NET/MASTER Network Control Language (NCL) Reference Manual

RESUME
Core Statements
2–50 106126 Tandem Computers Incorporated
Examples
The following example shows the general method of coding an ON block (error
handler) using the RESUME core statement:
PROC1: PROCEDURE
ON TESTERROR DO
IF &SYS.ERROR.RESUMEOK = 1
THEN RESUME
ELSE FLUSH
END
SIGNAL TESTERROR
SAY "PROCEDURE RESUMED AFTER TESTERROR SIGNALLED"
END PROC1
In the previous example, a user-specified condition (TESTERROR) is generated by the
SIGNAL core statement, and this condition is intercepted (or trapped) by a condition
handler or ON block having a matching name of TESTERROR. The condition is
ignored if &SYS.ERROR.RESUMEOK has the value 1 (one), indicating that RESUME is
possible.
The following shows a working example:
ZERO_DIV: PROCEDURE
ON ARITH_ERROR DO
SAY "WE HAVE A DIVIDE BY ZERO ERROR"
IF &SYS.ERROR.RESUMEOK = 1
THEN RESUME
ELSE FLUSH
END
&A=10
&B=0
/* DIVIDE BY ZERO AND GENERATE THE ARITHMETIC ERROR */
&C=&A/&B
SAY "WE HAVE NOW RESUMED AFTER AN INVALID DIVIDE BY ZERO"
END ZERO_DIV
In the previous example, an arithmetic error (division by 0) is intercepted (or trapped)
by coding an ON block (error handler) with the name ARITH_ERROR. The error
condition can be ignored if &SYS.ERROR.RESUMEOK has the value 1 (one),
indicating that RESUME is possible.