OPTIMIZE

The OPTIMIZE option specifies the type of optimization required.

Read syntax diagramSkip visual syntax diagram
   .-NOOPTIMIZE-------------------.   
>>-+-OPTIMIZE--+----------------+-+----------------------------><
               |    .-2----.    |     
               '-(--+-TIME-+--)-'     
                    +-0----+          
                    '-3----'          

ABBREVIATIONS: OPT, NOPT

OPTIMIZE(0)
Specifies fast compilation speed, but inhibits optimization.
OPTIMIZE(2)
Optimizes the machine instructions generated to produce a more efficient object program. This type of optimization can also reduce the amount of main storage required for the object module.
OPTIMIZE(3)
Performs all the optimizations done under OPTIMIZE(2) plus some additional optimizations. Under OPTIMIZE(3), the compiler will generally, but especially for programs with large blocks and many variables, generate smaller and more efficient object code. However, it might also take considerably more time and region to complete compilations under OPTIMIZE(3) than under OPTIMIZE(2).

It is strongly recommended that the DFT(REORDER) option be used with the OPTIMIZE option. In fact, the effect of OPTIMIZE is severely limited for any PROCEDURE or BEGIN-block for which all of the following conditions are true:

The use of OPTIMIZE(2) could result in a substantial increase in compile time over NOOPTIMIZE and a substantial increase in the space required. For example, compiling a large program at OPTIMIZE(2) might take several minutes and could require a region of 100M or more.

The use of OPTIMIZE(3) will increase the time and region needed for a compilation over what is needed under OPTIMIZE(2). For large programs, the time to compile a program under OPTIMIZE(3) can be more than twice the time needed under OPTIMIZE(2).

During optimization the compiler can move code to increase runtime efficiency. As a result, statement numbers in the program listing might not correspond to the statement numbers used in runtime messages.

NOOPTIMIZE is the equivalent of OPTIMIZE(0).

OPTIMIZE(TIME) is the equivalent of OPTIMIZE(2).

Note that the use of OPTIMIZE(2) or OPTIMIZE(3) severely limits the functionality of the TEST option, as follows:

The use of the PREFIX option with one or more of the checkout conditions (SIZE, STRINGRANGE, STRINGSIZE, and SUBSCRIPTRANGE) can significantly increase the time and space needed for a compilation.