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.

RULES option syntax

Read syntax diagramSkip visual syntax diagramNORULESRULES(,ENDPERIODNOENDPERIODEVENPACKNOEVENPACKLAXPERFNOLAXPERFSLACKBYTESNOSLACKBYTESOMITODOMINNOOMITODOMINUNREFNOUNREFALLNOUNREFSOURCELAXREDEFNOLAXREDEF)

Default is: NORULES

Abbreviations are:
  • ENDP = ENDPERIOD
  • EVENP = EVENPACK
  • LXPRF = LAXPERF
  • SLCKB = SLACKBYTES
  • Start of changeOOM = OMITODOMINEnd of change
  • Start of changeNOUNRA = NOUNREFALLEnd of change
  • Start of changeNOUNRS = NOUNREFSOURCEEnd of change
  • Start of changeLXRDF=LAXREDEFEnd of change

You can specify the following suboptions for RULES:

ENDPERIOD | NOENDPERIOD
The default is ENDPERIOD. Specifying NOENDPERIOD 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-*.
Start of changeEVENPACK | NOEVENPACKEnd of change
The default is EVENPACK. Specifying NOEVENPACK 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: Start of change
  • RULES(NOEVENPACK) 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®.
End of change
LAXPERF | NOLAXPERF
The default is LAXPERF. Specifying NOLAXPERF suboption 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, large amounts of space padding in MOVE statements, inefficient compiler options, and other cases.
SLACKBYTES | NOSLACKBYTES
The default is SLACKBYTES. Specifying NOSLACKBYTES 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.
Start of change
OMITODOMIN | NOOMITODOMIN
The default is OMITODOMIN. Specifying NOOMITODOMIN causes the compiler to issue warning messages for any OCCURS DEPENDING ON clauses that are specified without integer-1 (the minimum number of occurrences).

For more information about the OCCURS DEPENDING ON clause, see Variable-length tables in the Enterprise COBOL for z/OS® Language Reference.

End of change Start of change
UNREF | NOUNREFALL | NOUNREFSOURCE
The default is UNREF, which means that no reporting of unreferenced data items occurs.

When NOUNREFALL 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.

When NOUNREFSOURCE 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 NOUNREFSOURCE 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 NOUNREFALL or NOUNREFSOURCE is in effect.
End of change Start of change
LAXREDEF | NOLAXREDEF
The default is LAXREDEF. Specifying NOLAXREDEF will cause the compiler to issue warning messages when a data item is redefined by a smaller item on any level. The default option, LAXREDEF, causes the compiler to issue such warnings only for non-level-01 data items.
End of change

If the RULES option is specified with no suboptions, the default is Start of changeRULES(ENDPERIOD,EVENPACK,LAXPERF,SLACKBYTES,OMITODOMIN,UNREF,LAXREDEF)End of change.

Notes:
  • It is not necessary to specify all of the suboptions for RULES. If a suboption is not specified, the default value of that suboption takes effect. For example, if you specify RULES(NOENDP,NOSLCKB), Start of changeRULES(NOENDP,EVENP,LXPRF,NOSLCKB,OMITODOMIN,UNREF,LXRDF)End of change takes effect.
  • You can optionally use the RULES option with the MSGEXIT suboption of the EXIT compiler option to enforce local coding standards. For example, if you want to ensure that no programmers use periods instead of explicit scope delimiters to delimit conditional statements, you can change the severity of the ENDPERIOD message from Warning level (RC=4) to Severe level (RC=12). For a sample of how to modify the severity of this and other RULES messages, see the sample MSGEXIT in SIGYSAMP called IGYMSGXT.