Nested conditions in applications containing a COBOL program

You must take special care when dealing with nested conditions in ILC applications. For example, the following scenario can cause your application to abend:

  1. A nested condition occurs within a COBOL user-written condition handler (CBLUHDLR). Condition handlers written in COBOL must be compiled with Enterprise COBOL for z/OS, COBOL for OS/390 & VM, COBOL for MVS & VM, or COBOL/370.
  2. The COBOL user-written condition handler calls another user-written condition handler established using CEEHDLR to handle the nested condition.
  3. The user-written condition handler percolates the condition.

In this scenario, the condition can be percolated back to the stack frame where the original condition occurred. Since condition handling actions for the routine where the condition originally occurred include calling CBLUHDLR, CBLUHDLR can be recursively entered. This is not permitted under COBOL/370, and your application abends.

If CBLUHDLR is compiled with Enterprise COBOL for z/OS, COBOL for OS/390 & VM, or COBOL for MVS & VM; then the recursive call is allowed if RECURSIVE is specified in the PROGRAM-ID. A rule of thumb is to ensure that COBOL user-written condition handlers that call other user-written condition handlers do not regain control or, make sure they are capable of being recursively entered.