The REVERT statement unregisters an ON-unit that was registered using an ON statement.
| Component | Description |
|---|---|
condition |
One or more conditions. For more information, refer to Conditions. |
A REVERT statement only unregisters an ON-unit registered in a current block or procedure and cannot unregister an ON-unit registered in an upper block or procedure. If there is no ON-unit registered in a current block or procedure, a REVERT statement will not be executed.
The following example unregisters an ON-unit by using a REVERT statement:
ON ZERODIVIDE
BEGIN;
DISPLAY('ZERODIVIDE condition raised');
END;
REVERT ZERODIVIDE;
A = B / 0;
The ZERODIVIDE condition occurs due to "A = B / 0;" but the ON-unit registered using the ON statement is not executed because it has been unregistered by using the REVERT statement. If there is no registered ON-unit, a default action is executed according to a condition; either the ERROR condition occurs or the program execution continues. The ZERODIVIDE condition set an ERROR condition as the default action.