Exception actions

Exception actions define the type of action to be taken when an exception occurs.

There are five exception actions that can be executed if an exception is raised:

STOP
The program is immediately terminated. A message is displayed to the standard error with the location of the related statement, the error number, and the details of the exception.
CONTINUE
The program continues normally. The exception is ignored, but can be checked by testing the STATUS register, or the SQLCA.SQLCODE register for SQL errors.
CALL exception-function
The function exception-function is called by the runtime system. The function can be defined in any module, and must have zero parameters and zero return values. The STATUS variable will be set to the corresponding error number.
GOTO exception-label
The program execution continues at the label identified by exception-label, as if a GOTO instruction was issued after trapping the exception.
RAISE
This statement instructs the runtime system that the exception must propagated to the calling function.
Important: The WHENEVER[ANY] ERROR RAISE is not supported in a REPORT routine.