CRE Programmer's Guide
CRE Services
Common Run-Time Environment (CRE) Programmer’s Guide—528146-004
2-50
TNS CRE Trap Handler
The CRE and the run-time libraries validate portions of their data at strategic points of 
execution to ensure that the data values are not only valid, but that they are meaningful 
in the context in which they are used.
The CRE defines an error in which its data has been corrupted or its logic state has 
been compromised to be a catastrophic error. If your program has a logic error and 
writes over CRE data or run-time library data, the CRE or run-time library reports a 
“Corrupted data” or “Logic error” message. Your program might be using an unchecked 
array index that exceeds the bounds of its array or your program might be using a 
pointer that holds an incorrect address.
In addition to possibly corrupting CRE data or run-time library data, your program might 
be overwriting the pointers to the CRE’s data and to run-time library data. At G[0] and 
G[1], the CRE maintains pointers to its primary data structure, the Master Control Block 
(MCB), and to its Heap Control Block (HCB). If your program overwrites G[0]—for 
example, by using a nil-valued pointer to store data—the CRE reports a “Corrupt MCB” 
message when the CRE or a run-time library function validates the pointer. Note that 
run-time library functions might not validate the MCB pointer each time they use it. The 
result of an operation that uses data referenced by an invalid pointer is undefined.
TNS CRE Trap Handler
During program initialization, the TNS CRE enables a trap handler in its own domain.
If your program enables its own trap handler and a trap occurs, your trap handler can:
•
Attempt to write an error message to standard log.
•
Attempt to continue processing. 
•
Terminate your program. 
Either of the first two actions could fail, depending on the nature of the trap.
If the TNS CRE trap handler is in effect when a trap occurs, the operating system 
transfers control to the TNS CRE trap handler. The TNS CRE trap handler takes the 
following actions:
•
It validates its data. If it finds that its data has been corrupted, the TNS CRE 
invokes PROCESS_STOP_, specifying the ABEND option and the message text 
“Corrupted environment.”
•
If the TNS CRE finds that its data is intact, it attempts to write a message to 
standard log that identifies the trap that occurred. If the TNS CRE cannot write to 
standard log, it writes the message to the process’s home terminal—unless you 
specified the EXECUTION-LOG PARAM, in which case the TNS CRE does not 
write an error message.
•
If PARAM INSPECT ON was set when your program started execution, the TNS 
CRE calls the PROCESS_DEBUG_ system procedure.
Although the TNS CRE calls PROCESS_DEBUG_, you control whether your 
program uses the default debugging utility or the symbolic debugging utility by the 
values you specify for compiler directives, Binder settings, and TACL commands. 










