z/OS Language Environment Programming Guide for 64-bit Virtual Addressing Mode
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


Scenario 2: Exception handler present for divide-by-zero

z/OS Language Environment Programming Guide for 64-bit Virtual Addressing Mode
SA38-0689-00

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

Figure 1. Scenario 2: Division by zero with a user handler present in routine B
The divide-by-zero condition occurs during Routine B and Condition Handler 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 exception handler has been registered using __set_exception_handler() 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 long jumps back to a recovery point previously established by setjmp().
  4. The condition is now considered to be handled and is never seen by Language Environment default handler.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014