Condition-handling model description
- A function call in C or C++
- Entry into a compile unit in COBOL
- Entry into a procedure or begin block in PL/I
- Entry into an ON-unit in PL/I

Each Language Environment user
condition handler is explicitly registered through the callable service
CEEHDLR or through the USRHDLR runtime option. Language-defined handling
mechanisms are registered through language-provided constructs, such
as the PL/I ON statement or the C signal() function.
When a routine returns to its caller, its stack frame is removed from
the stack and the associated handlers are automatically unregistered.
Semantics associated with a routine are honored; for example, PL/I
semantics on a return specify that any ON-units within a routine will
be unregistered. If the USRHDLR runtime option is used, the
user-written condition handler is registered at stack frame 0.
- A hardware-detected interrupt
- An operating system-detected exception
- A condition generated by Language Environment callable services
- A condition explicitly signaled within a routine
The first three types of conditions are managed by Language Environment and
signaled if appropriate. The last may be signaled by user-written
code through a call to the service CEESGL or signaled by HLL semantics
such as SIGNAL in PL/I or raise in
C.
When a condition is signaled, whether by a user routine, by Language Environment in response to an operating system or hardware detected condition, or by a callable service, Language Environment directs the appropriate condition handlers in the stack frame to handle the condition. Condition handling proceeds first with user-written condition handlers in the queue, if present, then with any HLL-specific condition handlers, such as a PL/I ON-unit or a C signal handler, that may be established. The process continues for each frame in the stack, from the most recently allocated to the least recently allocated.
If a condition remains unhandled after the stack is traversed, the condition is handled by either Language Environment or by the default semantics of the language where the condition occurred.