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.
Default is: NORULES
- ENDP = ENDPERIOD
- EVENP = EVENPACK
- LXPRF = LAXPERF
- SLCKB = SLACKBYTES
- OOM = OMITODOMIN
- NOUNRA = NOUNREFALL
- NOUNRS = NOUNREFSOURCE
- LXRDF=LAXREDEF
You can specify the following suboptions for RULES
:
ENDPERIOD | NOENDPERIOD
- The default is
ENDPERIOD
. SpecifyingNOENDPERIOD
causes the compiler to issue warning messages when the scope of a conditional statement is terminated by a period instead of an explicit scope terminatorEND-*
.
EVENPACK | NOEVENPACK
- The default is
EVENPACK
. SpecifyingNOEVENPACK
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(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®.
LAXPERF | NOLAXPERF
- The default is
LAXPERF
. SpecifyingNOLAXPERF
suboption causes the compiler to issue warning messages for usage of inefficient COBOL features. These features might includeUSAGE DISPLAY
numeric data items in arithmetic statements, large amounts of space padding inMOVE
statements, inefficient compiler options, and other cases.
SLACKBYTES | NOSLACKBYTES
- The default is
SLACKBYTES
. SpecifyingNOSLACKBYTES
causes the compiler to issue warning messages for anySYNCHRONIZED
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.
OMITODOMIN | NOOMITODOMIN
- The default is
OMITODOMIN
. SpecifyingNOOMITODOMIN
causes the compiler to issue warning messages for anyOCCURS 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.
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 theFILE SECTION
,WORKING-STORAGE SECTION
,LOCAL-STORAGE SECTION
, andLINKAGE 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.WhenNOUNREFSOURCE
is specified, all level-01 and level-77 data items in theFILE SECTION
,WORKING-STORAGE SECTION
,LOCAL-STORAGE SECTION
, andLINKAGE 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
orNOUNREFSOURCE
is in effect.
- 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
LAXREDEF | NOLAXREDEF
- The default is
LAXREDEF
. SpecifyingNOLAXREDEF
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.
If the RULES
option
is specified with no suboptions, the default is RULES(ENDPERIOD,EVENPACK,LAXPERF,SLACKBYTES,OMITODOMIN,UNREF,LAXREDEF)
.
- 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 specifyRULES(NOENDP,NOSLCKB)
,RULES(NOENDP,EVENP,LXPRF,NOSLCKB,OMITODOMIN,UNREF,LXRDF)
takes effect. - If there are multiple
RULES
specifications for a compilation, the suboptions are additive, which means they are accumulated. For example, if you specifyRULES(ENDP)
, you will getRULES(ENDP)
in effect as well as whateverRULES
suboptions that were previously specified. If there is noRULES
specification for a suboption, the default will take effect. If a subsequentRULES
specification references a previously specified suboption, then the last specification takes effect. - You can optionally use the
RULES
option with theMSGEXIT
suboption of theEXIT
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 theENDPERIOD
message from Warning level (RC=4) to Severe level (RC=12). For a sample of how to modify the severity of this and otherRULES
messages, see the sample MSGEXIT in SIGYSAMP called IGYMSGXT.