Use OPTIMIZE to reduce the run time of your object program.
Optimization might also reduce the amount of storage your object program uses.
OPTIMIZE option syntax

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.
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:
- A technique sometimes used in old OS/VS COBOL programs was to place an unreferenced table after a referenced table and use
out-of-range subscripts on the first table to access the second table.
To see if your programs use this technique, use the SSRANGE compiler option with the CHECK(ON) runtime option.
To work around this problem, use the ability of newer COBOL to code large tables and use just one table.
- Place eye-catcher data items in the WORKING-STORAGE SECTION to identify the beginning and end
of the program data or to mark a copy of a program for a library tool that uses the data to identify the version of a program.
To solve this problem, initialize these items with PROCEDURE DIVISION statements rather than VALUE clauses.
With this method, the compiler will consider these items used and will not delete them.
The OPTIMIZE option is turned off in the case of a severe-level error or higher.
© Copyright IBM Corp.