OPTIMIZE

OPTIMIZE affects the level of optimization that is made to object code, and can result in performance improvements.

Syntax

Read syntax diagramSkip visual syntax diagramOPT=*012
Default
OPT=0
0
Specifies limited optimizations, which result in the shortest compilation time. When the TEST option is specified, full debug capabilities are available.
1
Specifies optimizations that improve application runtime performance. Optimizations at this level include basic inlining, strength reduction, simplification of complex operations into equivalent simpler operations, removal of some unreachable code and block rearrangement. Also, OPT=1 includes some intrablock optimizations such as common subexpression elimination and value propagation. When the TEST option is specified, most debug capabilities are available.
2
Specifies further optimizations, which include more aggressive simplifications and instruction scheduling. Also, some interblock optimizations such as global value propagation and loop invariant code motion are included. When the TEST option is specified, some debug capabilities are available.

Performance consideration: Using OPT=1 or OPT=2 generally results in more efficient runtime code.

Note:
  • The OPTIMIZE compiler option is fully supported for programs that use object-oriented syntax for Java™ interoperability.
  • Optimization is set to 0 if an S-level error or U-level error occurs, or if the Program Complexity Factor exceeds the MAXPCF integer specified.

For further details, see OPTIMIZE in the Enterprise COBOL Programming Guide.