OPTIMIZE

Use OPTIMIZE to reduce the run time of your object program. Optimization might also reduce the amount of storage your object program uses. Optimizations performed include the propagation of constants, instruction scheduling, and the elimination of computations whose results are never used.

Read syntax diagramSkip visual syntax diagram
OPTIMIZE option syntax

   .-NOOPTIMIZE----------------.   
>>-+---------------------------+-------------------------------><
   '-OPTIMIZE-+--------------+-'   
              |   .-STD--.   |     
              '-(-+-FULL-+-)-'     

Default is: NOOPTIMIZE

Abbreviations are: OPT|NOOPT

If OPTIMIZE is specified without any suboptions, OPTIMIZE(STD) will be in effect.

The FULL suboption requests that, in addition to the optimizations performed with OPT(STD), the compiler discard unreferenced data items from the DATA DIVISION and suppress generation of code to initialize these data items to the values in their VALUE clauses. When OPT(FULL) is in effect, all unreferenced level-77 items and elementary level-01 items are discarded. In addition, level-01 group items are discarded if none of their subordinate items are referenced. The deleted items are shown in the listing. If the MAP option is in effect, a BL number of XXXXX in the data map information indicates that the data item was discarded.

Recommendation: Use OPTIMIZE(FULL) for database applications. It can make a huge performance improvement, because unused constants included by the associated COPY statements are eliminated. However, if your database application depends on unused data items, see the recommendations below.

Unused data items: Do not use OPT(FULL) if your programs depend on making use of unused data items. In the past, this was commonly done in two ways:

The OPTIMIZE option is turned off in the case of a severe-level error or higher.

related concepts  
Optimization

related references  
Conflicting compiler options
  
MAXMEM