Compilation restrictions for user-written condition handlers with Enterprise COBOL Version 5 and Version 6

Refer to the restrictions for user-written condition handlers with Enterprise COBOL V5 and V6, and the differences between V5.1 and V5.2.

User-written condition handlers with Enterprise COBOL V5.1

With Enterprise COBOL V5.1, all COBOL programs in an application that use the Language Environment® service CEEHDLR to register a user-written condition handler must be compiled with one of the following configurations of compiler options:
  • OPTIMIZE(0)
  • OPTIMIZE(1) and TEST
  • OPTIMIZE(2) and TEST

Use of user-written condition handling services is incompatible with the advanced optimizations done with OPTIMIZE(1) or OPTIMIZE(2) and NOTEST, and can cause unpredictable results. You must specify the TEST option along with OPTIMIZE(1) or OPTIMIZE(2), which reduces the amount of optimization performed.

User-written condition handlers with Enterprise COBOL V5.2 and V6

With Enterprise COBOL V5.2 and V6, a new VOLATILE clause is added to the format 1 data description entry, which helps to address issues with using higher levels of optimization for programs that use Language Environment (LE) condition handlers registered via the LE service CEEHDLR. When OPTIMIZE(1) or OPTIMIZE(2) is used without the TEST compiler option for such programs, care must be taken. In particular, if a condition handler program accesses data items that are not defined local to the condition handler program itself (for example, data items defined in the application as EXTERNAL), such data items must be defined with the VOLATILE clause in every program where a condition can occur. Otherwise, the handler program might not use the latest value of the data item. In this case, the use of the VOLATILE clause is preferred over the use of the TEST option for performance considerations.

For condition handler scenarios that also use the SERVICE LABEL compiler-directing statement with the LE service CEE3SRP to set a resume point, the optimization of such programs can be significantly reduced.

Note: VOLATILE is now a reserved word in Enterprise COBOL. Existing programs that use VOLATILE as a user-defined word (for example, as a data name or paragraph name) will get S-level diagnostic messages with Enterprise COBOL V5.2 and V6. You must change these instances of VOLATILE to other words such as VOLATILE-X, or you can use the CCCA utility to do it for you.

For more information about the VOLATILE clause, see VOLATILE clause in the Enterprise COBOL for z/OS® Language Reference.