Concepts of Language Environment condition handling

There are two main concepts of Language Environment condition handling: the stack frame-based model and the unique, 12-byte condition token that it provides to communicate information about conditions to Language Environment resources and services.

Language Environment uses stack frames to keep track of a routine's order of execution, and the condition handlers available for each routine. This ensures that conditions can be isolated and handled precisely where they occur in a routine.

One of the most useful features of the condition handling model is the condition token: a 12-byte data type that contains information about each condition. You can use the condition token as a feedback code or to communicate with Language Environment message services. Unlike a return code, which is specific to the caller and callee of a routine, a condition token communicates between all the routines involved in an application. A condition token contains more instance-specific information about a condition than a return code does.

Language Environment supplements, but does not replace, existing HLL condition handling techniques such as C/C++ signal handlers (created using the signal() function), PL/I ON-units, and return code-based programming techniques. HLL condition handling techniques are discussed in Language Environment and HLL condition handling interactions.

Language Environment condition handling is most beneficial when used as part of mixed-language applications because it is consistent for all applications. If you are coding in a single language, you can use the condition handling semantics of that language, but if you have any ILC applications, you need the consistency across languages that Language Environment provides.

Language Environment can respond in many ways to a condition. For example, Language Environment can invoke a condition handler, a term used to define the specific routine that actually recognizes and responds to the condition. A condition handler can be registered by the CEEHDLR (register user-written condition handler) service, or be part of the language-specific condition handling services, such as a C/C++ signal handler or a PL/I ON-unit. HLL condition handling semantics that are intrinsic to the programming language also exist; an example is the COBOL ON SIZE phrase.

Related runtime options are as follows:
ABPERC
Percolates (removes from Language Environment condition handling) a single abend
DEPTHCONDLMT
Indicates how deep conditions might be nested
ERRCOUNT
Indicates how many severity 2, 3, and 4 conditions can occur before issuing an abend.
TRAP
Indicates whether Language Environment routines should handle abends and program interrupts.
XUFLOW
Indicates if exponent underflow should cause program interrupt.
Related callable services are as follows:
CEE3CIB
Returns pointer to the condition information block that is associated with a condition token passed to a user-written condition handler
CEE3GRN
Gets name of routine that incurred the condition currently being processed
CEE3GRO
Returns the offset of the location within the most current Language Environment-conforming routine where a condition occurred
CEE3SPM
Queries or modifies (by enabling or masking) hardware conditions
CEE3SRP
Sets a resume point within user application code to resume from a Language Environment user condition handler
CEEGQDT
Retrieves q_data token from the ISI
CEEHDLR
Registers user-written condition handler
CEEHDLU
Unregisters user-written condition handler
CEEITOK
Returns the initial condition token from the current condition information block
CEEMRCE
Moves the resume cursor to an explicit location where resumption is to occur after a condition has been handled
CEEMRCR
Moves resume cursor relative to handle cursor. You might view this as performing a GOTO out of block, or setjmp() and longjmp().
CEESGL
Signals a condition