Scenario 3: Condition handler present for divide-by-zero

Scenario 3 is much the same as scenario 2, except that routine B has a user-written condition handler established to handle the divide-by-zero condition. Refer to Figure 1 throughout the following scenario.

Figure 1. Scenario 3: Division by zero with a user handler present in routine B
Routine B has a user-written condition handler to handle the divide-by-zero condition in routine B.

The handler established by routine B is designed to deal with divide-by-zero and possibly other conditions that occur either during its execution or in the routines that it calls. For a divide-by-zero condition, the handler is to print a message and continue processing.

  1. A divide-by-zero exception occurs in routine B.
  2. The divide-by-zero exception is enabled by the language of the stack frame in which it occurred because it is a problem that, if it remains unhandled, causes termination.
  3. The following occurs in the condition step:
    • If a user-written condition handler has been registered using the CEEHDLR callable service on routine B's stack frame, it is given control. The handler recognizes the divide-by-zero as a condition it is capable of dealing with. It produces a message, does appropriate clean-up, and then causes resumption either through HLL constructs or Language Environment services.
  4. The condition is now considered to be handled and is never seen by stack frame A or the Language Environment default handler.