NET/MASTER Network Control Language (NCL) Reference Manual
RETRY
Core Statements
2–52 106126 Tandem Computers Incorporated
Example
The following example retries the statement that generated the error condition
(division by 0 (zero)). After testing the &SYS.ERROR.RETRYOK system variable to see
if the error can be retried, the error is corrected and the statement retried:
PROC1: PROCEDURE
ON ERROR DO
IF &SYS.ERROR.RETRYOK = 1 THEN DO
&B=1 /* CORRECT THE ERROR */
RETRY
END
ELSE SAY "GOING ... GONE!"
FLUSH
END
&A=10
&B=0
&C=&A/&B /* DIVIDE BY ZERO */
SAY " IT’S O.K. NOW "
END PROC1
In the preceding example, if the attempted correction of the error produces the same
condition, NCL sets &SYS.ERROR.RETRYOK to 0 (zero) and the RETRY statement is
not executed. This protects you from uncontrolled repetition of the original error. In
the preceding example, this would be the case if, by mistake, &B was again given the
value of 0 (zero). The procedure would then be terminated by the FLUSH statement.
If you attempt to retry an error without taking any corrective action, NCL terminates
the procedure unconditionally with an error code of 24.