WHENEVER statement is used to specify an action that is to be performed, when 4GL encounters an error, a warning, an end-of-data condition or other event during the execution of a program.
Event |
An exceptional condition which can be trapped using the WHENEVER statement |
Event handler |
A programmer-defined or built-in 4GL function with no parentheses and no argument list |
Label |
A previously declared label |
WHENEVER statement cannot appear outside a program block, it must occur either in the MAIN, FUNCTION or REPORT program block.
WHENEVER statement must include the identification of an exceptional condition, and the identifier of the way in which 4GL should react to this condition if it occurs during the execution of a program.