How to tone down optimization for complex or large programs?
Dan_Z 27000582KQ Visits (4745)
In COBOL for z/OS, V5,1, when compiling your source files that are too complex or in a relatively large size, and if you have specified the OPTIMIZE level, it may take excessive amount of time or storage. Thus a new compiler option, MAXPCF, is introduced to allow you to control the amount of time and storage used when optimizing a program. You can specify the maximum program complexity factor with this option. The new term, Program Complexity Factor (PCF), is a value calculated by the compiler, and represents the complexity of the program being compiled.
PCF is documented in the listing file, and the following aspects affect PCF:
Here's a fragment taken from the short listing example of the COBOL
See the syntax of the MAXPCF option below:
n must be an integer of 0 – 999999, and the default value is MAXPCF(60000).
If you specify MAXPCF(0), no limit will be enforced on the complexity of the program.
If you specify the MAXPCF(n) option and n is not zero, when PCF exceeds n, even if you've specified OPTIMIZE(1) or OPTIMIZE(2), it will be reset to OPTIMIZE(0), and a warning message is generated.
In all, specifying MAXPCF value can avoid excessive compilation time or storage requirements when compiling a suite of programs, and you don't need to specify individual OPTIMIZE(n) option values for each program. However, please note that specifying MAXPCF will limit the optimization effects, and reduce the performance of the generated code, too.