RULES

You can use the RULES option to request information about your program from the compiler to improve the program by flagging certain types of source code at compile time.

Syntax

Read syntax diagramSkip visual syntax diagramRULES=(NO,ENDPNOENDPEVENPNOEVENPLXPRFNOLXPRFSLCKBNOSLCKBOOMNOOOMUNREFNOUNRANOUNRSLXRDFNOLXRDF)
Default
RULES = (NO)
Has the same effect as RULES=(ENDP,EVENP,LXPRF,SLCKB,OOM,UNREF,LXRDF).

You can specify the following suboptions for RULES other than default ones:

(NOENDP)
Causes the compiler to issue warning messages when the scope of a conditional statement is terminated by a period instead of an explicit scope terminator END-*.
(NOEVENP)
Causes the compiler to issue warning messages for any USAGE PACKED-DECIMAL (COMP-3) data items that have an even number of digits because those data items whose unused bits are not zero can lead to an unexpected program behavior.
Notes:
  • RULES=(NOEVENP) helps you identify USAGE PACKED-DECIMAL (COMP-3) data items that have unused extra space reserved for them. However, it is not necessary to change those data items to have an odd number of digits, it is only a slightly better way of programming.
  • The compiler does not issue messages for even-digit PACKED-DECIMAL data items if the name starts with DFH, DSN, EYU, or SQL. That is, data items generated for/by CICS® and Db2®.
(NOLXPRF)
Causes the compiler to issue warning messages for usage of inefficient COBOL features. These features might include USAGE DISPLAY numeric data items in arithmetic statements, substantial amounts of space padding in MOVE statements, inefficient compiler options, and other cases.
(NOSLCKB)
Causes the compiler to issue warning messages for any SYNCHRONIZED data items that cause the compiler to add slack bytes, either slack bytes within records or slack bytes between records. Each data item that causes slack bytes to be added gets a compiler diagnostic.
(NOOOM)
Causes the compiler to issue warning messages for any OCCURS DEPENDING ON clauses that are specified without integer-1 (the minimum number of occurrences).
(NOUNRA)
When NOUNRA is specified, all level-01 and level-77 data items in the FILE SECTION, WORKING-STORAGE SECTION, LOCAL-STORAGE SECTION, and LINKAGE SECTION that are unreferenced, including no subordinate items referenced when the item is a group, are reported, regardless of whether the definition of the data item appears directly in the user source program or was included in the program from a copy member.
(NOUNRS)
When NOUNRS is specified, all level-01 and level-77 data items in the FILE SECTION, WORKING-STORAGE SECTION, LOCAL-STORAGE SECTION, and LINKAGE SECTION that are unreferenced, including no subordinate items referenced when the item is a group, are reported only if the definition of the data item appears directly in the user source program.
Notes:
  • In COBOL, the definition of a single group item can spread across different files. When this occurs, and if the definition of the level-01 data item of the group is in the main source file, then those data items that are unreferenced will be reported when NOUNRS is in effect.
  • Data items with the name prefix DFH, DSN, EYU, or SQL (that is, data items generated for/by CICS and Db2) will not be reported when NOUNRA or NOUNRS is in effect.
(NOLXRDF)
When NOLXRDF is specified, the compiler will issue warning messages when a data item is redefined by a smaller item on any level, including level-01.
Notes:
  • It is not necessary to specify all of the suboptions for RULES. If a suboption is not specified, the default takes effect.
  • RULES must be specified with at least one suboption for installation defaults.