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
- 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.
For more information about the VOLATILE clause, see VOLATILE clause in the Enterprise COBOL for z/OS® Language Reference.