[Next] [Up] [Previous]

The RAISE Statement

A string beginning with $ can be used to name a user-defined condition; this condition can be set with the statement

       RAISE condition

where condition is again a character expression.

Such conditions are global, and may be raised in a subroutine executing in parallel to the programs that will take action in response to the condition. Most normal conditions are local; however, setting a local condition produces no result that cannot be obtained with conventional control structures.

When a program responds to a condition, that condition is cleared from the viewpoint of the program responding to it.

When a condition is raised during expression evaluation, or within a FOR loop, it is possible that some variables in memory will have invalid values, and that attempts to set them will be discarded if return is made to the place causing the exception.

Conditions such as FIXEDOVERFLOW, FLOATOVERFLOW, ZERODIVIDE, UNDERFLOW arise from arithmetic procedures that return results. The pre-defined left-function _RESULT can be assigned a value where it is desired that that value be returned as the result of the failed arithmetic operation.

As well, the functions _OPERAND(n) and _ARGUMENT(n) exist to return the operands of a failed operator or function when that is possible, by examining the code at the point prior to where return is to be made, and looking at variables in storage or saved registers. This enables the EXALT programmer to decree, for example, that 0/0 is always 1, but anything else divided by zero will still cause an error, a feat impossible in many other languages that also provide exception handling.


[Next] [Up] [Previous]