This scenario describes the behavior of an application that contains
a COBOL and
a Fortran routine.
Refer to Figure 1 throughout the following
discussion. In this scenario, a Fortran main
routine invokes a COBOL subroutine.
An exception occurs in the COBOL subroutine.
Figure 1. Stack contents
when the exception occurs
The actions taken follow the three Language Environment condition
handling steps: enablement, condition, and termination imminent.
- In the enablement step, COBOL determines
whether the exception that occurred should be handled as a condition.
- If the exception is to be ignored, control is returned to the
next sequential instruction after where the exception occurred.
- If the exception is to be enabled and processed as a condition,
the condition handling step, described below, takes place.
- 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, the condition handling
step ends. Processing continues in the routine to which the resume
cursor points.
Two areas to watch out for here are resuming from
an IBM® condition of severity
2 or greater (see the chapter on coding a user-written condition handler
in z/OS Language Environment Programming Guide)
and moving
the resume cursor in an application that contains a COBOL program
(see GOTO out-of-block and move resume cursor).
In this example,
no user-written condition handler is registered for the condition,
so the condition is percolated.
- If the condition has a Facility_ID of IGZ, the condition is COBOL-specific.
The COBOL default
actions occur. If COBOL doesn't
recognize the condition, condition handling continues.
- There is no user-written condition handler on the Fortran stack
frame (because CEEHDLR cannot be called from a Fortran routine),
and the condition is percolated.
- If the condition is of severity 0 or 1, 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.