Exception occurs in C
In this scenario, a COBOL main program invokes a C subroutine and an exception occurs in the C subroutine. Refer to Figure 1 throughout the following discussion.
The actions taken follow the three Language Environment condition handling steps: enablement, condition, and termination imminent.
- In the enablement step, C determines
whether the exception in the C routine should be enabled and treated
as a condition. If any of the following are true, the exception is
ignored, and processing continues at the next sequential instruction
after which the exception occurred:
- You specified SIG_IGN for the exception in a
call to signal(). Note: The system or user abend corresponding to the signal(SIGABND) or the Language Environment message 3250 is not ignored. The enclave is terminated.
- The exception is one of those listed as masked in Table 2, and you have not enabled it using the CEE3SPM callable service.
- You did not specify any action, but the default action for the condition is SIG_IGN (see Table 2).
- You are running under CICS® and a CICS handler is pending.
- You specified SIG_IGN for the exception in a
call to signal().
- If a user-written condition handler has been registered using
CEEHDLR on the C stack
frame, it is given control. If it issues a resume, with or without
moving the resume cursor, the condition handling step ends. Processing
continues in the routine to which the resume cursor points.
In this example, there is not a user-written condition handler registered for the condition, so the condition is percolated.
- The global error table is now examined for signal handlers that
have been registered for the condition.
If there is a signal handler registered for the condition, it is given control. If it issues a resume or a call to longjmp(), the condition handling step ends. Processing resumes in the routine to which the resume cursor points. You must be careful when issuing a longjmp() in an application that contains a COBOL program; see CEEMRCR and COBOL for details.
In this example no C signal handler is registered for the condition, so the condition is percolated.
- The condition is still unhandled. If C does not recognize the condition, or if the C default action (listed in Table 2) is to terminate, the condition is percolated.
- If a user-written condition handler has been registered using
CEEHDLR on the COBOL stack
frame, it is given control. If it issues a resume, with or without
moving the resume cursor, the condition handling step ends. Processing
continues in the routine to which the resume cursor points. You must
be careful when moving the resume cursor in an application that contains
a COBOL program;
see CEEMRCR and COBOL for details.
In this example, no user-written condition handler is registered for the condition, so the condition is percolated.
- If the condition is of severity 0 or 1, the Language Environment default actions take place, as described in Table 1.
- If the condition is of severity 2 or above, Language Environment default action is to promote the condition to T_I_U (Termination Imminent due to an Unhandled condition) and redrive the stack. Condition handling now enters the termination imminent step.
- If, on the second pass of the stack, no condition handler moves the resume cursor and issues a resume, Language Environment terminates the thread.