Run-time Errors

A run-time error is a program exception that occurs during execution. Some examples of program exceptions are:

When such errors occur, the run-time system responds by raising an appropriate condition. If the program has established a handler for the particular condition, the handler is invoked; otherwise, the run-time system performs a default action. A program establishes handlers for various conditions by means that differ from language to language: PL/I procedures can establish handlers by using ON-units, FORTRAN procedures can establish handlers for certain kinds of exceptions by using the ERR= and END= specifiers on I/O statements, and other languages provide no means of handling exceptions.

In the absence of a handler, the default action performed by the run-time system for most conditions except the ENDPAGE (f), FINISH, UNDERFLOW, and ERROR conditions is simply to raise the ERROR condition.

The message line has the following form:

*** Condition ERROR raised

If the ERROR condition was raised as the default action for another condition, the above line is followed by another line:

*** Unhandled condition cccccc[for 000000 on file ffffff] at PC=xxxxxxxx

where

cccccc Is the name of a condition and indicates the nature of the program exception as described in the remainder of this section.
000000 Describes the I/O operation.
ffffff Is the name of the file.
xxxxxxxx      Is the hexadecimal value of the PC at the time the error was detected (usually the address of an instruction in a routine from a run-time library).

If the error is related to an I/O operation on a file, the optional part of the message appears.

I/O errors are program exceptions related to operations on files. End-of-file on sequential input may raise the ENDFILE condition, and errors opening a file usually raise the UNDEFINEDFILE condition. The condition name used by the run-time system for other I/O errors has the form

I0_ERROR_nnn

where nnn is the error code for the particular error: either a run-time system error code or a UNIX system error code.

The AREA condition is raised in two situations: (1) if an attempt is made to allocate a based variable within an area that has insufficient free storage for the allocation, or (2) if an attempt is made to assign one area to another where the maximum size of the source area exceeds that of the target area.

Floating point exceptions raise conditions OVERFLOW, UNDERFLOW, ZERODIVIDE, CONVERSION, INVALID_OPERAND, or INVALID_mmmm, where mmmm is the name of a floating-point function or operation.

OVERFLOW Indicates that the magnitude of a computational result is too large to represent.
UNDERFLOW Indicates that the magnitude of a computational result is too close to zero to represent.
ZERODIVIDE Indicates an attempt to divide by zero (note that the special case of zero divided by zero raises SIGFPE, however).
Note:

This condition is not recognized in cases where integer division is performed. In this case, the ONCODE for a general computational error (99200) is returned.

CONVERSION Is raised when a floating-point value cannot be correctly converted to an integer, to or from another floating-point value of a different size, or to or from a character string representation.
INVALID_OPERAND Results when an operand to a floating-point function (such as SIN, COS, TAN, EXP, and LOG) is out of the range capable of being handled accurately by the system.
INVALID_mmmm     Usually denotes an invalid operand to the indicated floating-point function or operation: the operand is Not-a-Number, +/- infinity, or is outside the mathematical domain of the function or operation.

RTS errors are program exceptions detected by the run-time system not related to I/O. The condition name raised for these errors has the form

 RTS_ERROR_nnn

where nnn is one of the error codes listed in Table B-1. An RTS error related to the conversion of a value from one data type to another is sometimes reported as the CONVERSION condition.

Finally, UNIX signals are errors detected by the system and reported to the program by the system's signaling mechanism. Signaled condition names have the form

SIGxxxx

where xxxx depends on the signal value. The various UNIX signal values are described in your UNIX documentation. On some UNIX systems, floating-point exceptions appear as SIGFPE.