Most of the RULES suboptions affect only the severity with which certain coding practices, such as not declaring variables, are flagged and have no impact on performance. However, these suboptions do have an impact on performance.
When you use the RULES(IBM) option, the compiler supports scaled FIXED BINARY and, what is more important for performance, generates scaled FIXED BINARY results in some operations. Under RULES(ANS), scaled FIXED BINARY is not supported and scaled FIXED BINARY results are never generated. This means that the code generated under RULES(ANS) always runs at least as fast as the code generated under RULES(IBM), and sometimes runs faster.
For example, consider the following code fragment:
dcl (i,j,k) fixed bin(15); . . . i = j / k;
Under RULES(IBM), the result of the division has the attributes FIXED BIN(31,16). This means that a shift instruction is required before the division and several more instructions are needed to perform the assignment.
Under RULES(ANS), the result of the division has the attributes FIXED BIN(15,0). This means that a shift is not needed before the division, and no extra instructions are needed to perform the assignment.
Under RULES(LAXCTL), a CONTROLLED variable may be declared with constant extents and yet allocated with different extents.
For instance, under RULES(LAXCTL), you may declare a structure as follows:
dcl
1 a controlled,
2 b char(17),
2 c char(29);
However, you could then allocate it as follows:
allocate
1 a,
2 b char(170),
2 c char(290);
This has disastrous consequences for performance because it means that whenever the compiler sees a reference to the structure A or to any member of that structure, the compiler is forced to assume that it knows nothing about the lengths, dimensions or offsets of the fields in it.
However, the RULES(NOLAXCTL) option disallows this coding practice: under RULES(NOLAXCTL), if you then want to allocate a CONTROLLED variable with a variable extent, then that extents must be declared either with an asterisk or with a non-constant expression. Consequently, under RULES(NOLAXCTL), when a CONTROLLED variable is declared with constant extents, then the compiler can generate much better code for any reference to that variable.