While a PL/I program is running, certain events can occur for which you can do some testing, issue a response, or take recovery action. These events are called conditions, and are raised when detected. Conditions can be unexpected errors (e.g. overflow, input/output transmission error) or expected errors (e.g. end of an input file). Conditions can be raised directly in a program through the use of the SIGNAL statement (this can be very useful during testing).
Application control over conditions is accomplished through the enablement of conditions and the establishment of actions to be performed when an enabled condition is raised. When a condition is disabled, its raising causes no action; the program is unaware that the event was raised. The established action can be an ON-unit or the implicit action defined for the condition.
When an ON-unit is invoked, it is treated as a procedure without parameters. To assist you in making use of ON-units, built-in functions and pseudovariables are provided that you can use to inquire about the cause of a condition. Pseudovariables are often used for error correction and recovery. Built-in functions and pseudovariables are listed in Built-in functions, pseudovariables, and subroutines.
The implicit action for many conditions is to raise the ERROR condition. This provides a common condition that can be used to check for a number of different conditions, rather than checking each condition separately. The ONCODE built-in function is particularly useful here, as it can be used to identify the specific circumstances that raised the conditions. Codes corresponding to the conditions and errors detected are listed in Messages and Codes.