Rational Developer for System z
PL/I for Windows, Version 8.0, Programming Guide

RULES

This option allows or disallows certain language capabilities and allows you to choose semantics when alternatives are available. It can help you diagnose common programming errors.

Read syntax diagramSkip visual syntax diagram             .-+---+----------------------------------------.
             | '-,-'                                        |
             V   .-IBM-.                                    |
>>-RULES--(----+-+-ANS-+----------------------------------+-+--)-><
               | .-BYNAME---.                             |
               +-+-NOBYNAME-+-----------------------------+
               | .-NODECSIZE-.                            |
               +-+-DECSIZE---+----------------------------+
               | .-ELSEIF---.                             |
               +-+-NOELSEIF-+-----------------------------+
               | .-EVENDEC---.                            |
               +-+-NOEVENDEC-+----------------------------+
               | .-GOTO---.                               |
               +-+-NOGOTO-+-------------------------------+
               | .-GLOBALDO---.                           |
               +-+-NOGLOBALDO-+---------------------------+
               | .-NOLAXBIF-.                             |
               +-+-LAXBIF---+-----------------------------+
               | .-NOLAXCTL-.                             |
               +-+-LAXCTL---+-----------------------------+
               | .-LAXDCL---.                             |
               +-+-NOLAXDCL-+-----------------------------+
               | .-NOLAXDEF-.                             |
               +-+-LAXDEF---+-----------------------------+
               | .-LAXENTRY-------------------------.     |
               +-+-NOLAXENTRY--+------------------+-+-----+
               |               |    .-STRICT-.    |       |
               |               '-(--+-LOOSE--+--)-'       |
               | .-LAXIF---.                              |
               +-+-NOLAXIF-+------------------------------+
               | .-LAXINOUT---.                           |
               +-+-NOLAXINOUT-+---------------------------+
               | .-LAXLINK---.                            |
               +-+-NOLAXLINK-+----------------------------+
               | .-LAXMARGINS---------------------------. |
               +-+-NOLAXMARGINS--+--------------------+-+-+
               |                 |    .-STRICT---.    |   |
               |                 '-(--+-XNUMERIC-+--)-'   |
               | .-LAXPUNC---.                            |
               +-+-NOLAXPUNC-+----------------------------+
               | .-LAXQUAL-------------------------.      |
               +-+-NOLAXQUAL--+------------------+-+------+
               |              |    .-LOOSE--.    |        |
               |              '-(--+-STRICT-+--)-'        |
               | .-LAXRETURN---.                          |
               +-+-NOLAXRETURN-+--------------------------+
               | .-LAXSCALE---.                           |
               +-+-NOLAXSCALE-+---------------------------+
               | .-LAXSEMI---.                            |
               +-+-NOLAXSEMI-+----------------------------+
               | .-LAXSTG---.                             |
               +-+-NOLAXSTG-+-----------------------------+
               | .-NOLAXSTRZ-.                            |
               +-+-LAXSTRZ---+----------------------------+
               | .-MULTICLOSE---.                         |
               +-+-NOMULTICLOSE-+-------------------------+
               | .-PADDING---.                            |
               +-+-NOPADDING-+----------------------------+
               | .-PROCENDONLY---.                        |
               +-+-NOPROCENDONLY-+------------------------+
               | .-SELFASSIGN---.                         |
               +-+-NOSELFASSIGN-+-------------------------+
               | .-STOP---.                               |
               +-+-NOSTOP-+-------------------------------+
               | .-UNREF---.                              |
               '-+-NOUNREF-+------------------------------'
 
IBM or ANS
Under the IBM suboption:

Under the ANS suboption:

BYNAME or NOBYNAME
Specifying NOBYNAME causes the compiler to flag all BYNAME assignments with an E-level message.
DECSIZE or NODECSIZE
Specifying DECSIZE causes the compiler to flag any assignment of a FIXED DECIMAL expression to a FIXED DECIMAL variable when the SIZE condition is disabled if the SIZE condition could be raised by the assignment.

Specifying RULES(DECSIZE) may cause the compiler to produce a large number of messages since if SIZE is disabled, then any statement of the form X = X + 1 will be flagged if X is FIXED DECIMAL.

ELSEIF or NOELSEIF
Specifying NOELSEIF causes the compiler to flag any ELSE statement that is immediately followed by an IF statement and suggest that it be rewritten as a SELECT statement.

This option can be useful in enforcing that SELECT statements be used rather than a series of nested IF-THEN-ELSE statements.

EVENDEC or NOEVENDEC
Specifying NOEVENDEC causes the compiler to flag any FIXED DECIMAL declaration that specifies an even precision.
GOTO|NOGOTO
Specifying NOGOTO causes all GOTO statements to be flagged except for those out of BEGIN blocks.
LAXBIF or NOLAXBIF
Specifying LAXBIF causes the compiler to build a contextual declaration for built-in functions, such as NULL, even when used without an empty parameter list.
GLOBALDO|NOGLOBALDO
Specifying NOGLOBALDO causes the compiler to flag all DO loop control variables that are declared in a parent block.
LAXCTL or NOLAXCTL
Specifying LAXCTL allows a CONTROLLED variable to be declared with a constant extent and yet to be allocated with a differing extent. NOLAXCTL requires that if a CONTROLLED variable is to be allocated with a varying extent, then that extent must be specified as an asterisk or as a non-constant expression.

The following code is illegal under NOLAXCTL:

    dcl a bit(8) ctl;
    alloc a;
    alloc a bit(16);

But this code would still be valid under NOLAXCTL:

    dcl b bit(n) ctl;
    dcl n fixed bin(31) init(8);
    alloc b;
    alloc b bit(16);
LAXDCL or NOLAXDCL
Specifying LAXDCL allows implicit declarations. NOLAXDCL disallows all implicit and contextual declarations except for BUILTINs and for files SYSIN and SYSPRINT.
LAXDEF or NOLAXDEF
Specifying LAXDEF allows so-called illegal defining to be accepted without any compiler messages (rather than the E-level messages that the compiler would usually produce).
LAXENTRY or NOLAXENTRY
Specifying LAXENTRY allows unprototyped entry declarations. Specifying NOLAXENTRY will cause the compiler to flag all unprototyped entry declarations, i.e. all ENTRY declares that do not specify a parameter list. Note that this would mean that if an ENTRY should have no parameters, it should be declared as ENTRY() rather than simply as ENTRY.
STRICT
Specifying RULES(NOLAXENTRY(STRICT)) causes the compiler to flag unprototyped entry declarations that have the OPTIONS(ASM) attribute.
LOOSE
Specifying RULES(NOLAXENTRY(LOOSE)) causes the compiler not to flag unprototyped entry declarations that have the OPTIONS(ASM) attribute.
RULES(LAXENTRY) is the default.
LAXIF or NOLAXIF
Specifying RULES(NOLAXIF) will cause the compiler to flag any IF, WHILE, UNTIL, and WHEN clauses that do not have the attributes BIT(1) NONVARYING.

The following would all be flagged under NOLAXIF:

  dcl i fixed bin;
  dcl b bit(8);
  ...
  if i then ...
  if b then ...
LAXINOUT | NOLAXINOUT
Specifying NOLAXINOUT causes the compiler to assume that all ASSIGNABLE BYADDR parameters are input (and possibly output) parameters and hence to issue a warning if it thinks such a parameter has not been initialized.
LAXLINK or NOLAXLINK
Specifying NOLAXLINK causes the compiler to flag any assign or compare of two ENTRY variables or constants if any of the following do not match:
LAXMARGINS or NOLAXMARGINS
Specifying NOLAXMARGINS causes the compiler to flag, depending on the setting of the STRICT and XNUMERIC suboption, lines containing non-blank characters after the right margin. This can be useful in detecting code, such as a closing comment, that has accidentally been pushed out into the right margin.

If the NOLAXMARGINS and STMT options are used together with one of the preprocessors, then any statements that would be flagged because of the NOLAXMARGINS option will be reported as statement zero (since statement numbering occurs only after all the preprocessors are finished, but the detection of text outside the margins occurs as soon as the source is read).

STRICT
Under the STRICT suboption, the compiler will flag any line containing non-blank characters after the right margin
XNUMERIC
Under the XNUMERIC suboption, the compiler will flag any line containing non-blank characters after the right margin except if the right margin is column 72 and columns 73 through 80 all contain numeric digits
LAXPUNC or NOLAXPUNC
Specifying NOLAXPUNC causes the compiler to flag with an E-level message any place where it assumes punctuation that is missing.

For instance, given the statement "I = (1 * (2);", the compiler assumes that a closing right parenthesis was meant before the semicolon. Under RULES(NOLAXPUNC), this statement would be flagged with an E-level message; otherwise it would be flagged with a W-level message.

LAXQUAL | NOLAXQUAL
Specifying NOLAXQUAL(LOOSE) causes the compiler to flag any reference to structure members that are not level 1 and are not dot qualified. Consider the following example:
dcl
  1 a,
    2 b,
      3 b fixed bin,
      3 c fixed bin;

c   = 11;   /* would be flagged */
b.c = 13;   /* would not be flagged */
a.c = 17;   /* would not be flagged */

Specifying NOLAXQUAL(STRICT) causes the compiler to flag any reference to structure members that do not include the level-1 name. Consider the following example:

dcl
  1 a,
    2 b,
      3 b fixed bin,
      3 c fixed bin;

c   = 11;   /* would be flagged */
b.c = 13;   /* would be flagged */
a.c = 17;   /* would not be flagged */
LAXRETURN|NOLAXRETURN
Specifying NOLAXRETURN causes the compiler to generate code to raise the ERROR condition when a RETURN statement is used in either of the following ways: RULES(LAXRETURN) is the default.
LAXSCALE|NOLAXSCALE
Specifying NOLAXSCALE causes the compiler to flag any FIXED BIN(p,q) or FIXED DEC(p,q) declare where q < 0 or p < q.
LAXSEMI or NOLAXSEMI
Specifying NOLAXSEMI causes the compiler to flag any semicolons appearing inside comments.
LAXSTG or NOLAXSTG
Specifying NOLAXSTG causes the compiler to flag declares where a variable A is declared as BASED on ADDR(B) and STG(A) > STG(B) even (and this is the key part) if B is a parameter.

The compiler would already flag this kind of problem if B were in AUTOMATIC or STATIC storage, but it does not, by default, flag this when B is a parameter (since some customers declare B with placeholder attributes that do not describe the actual argument). For those customers whose parameter and argument declares match (or should match), specifying RULES(NOLAXSTG) may help detect more storage overlay problems.

LAXSTRZ or NOLAXSTRZ
Specifying LAXSTRZ causes the compiler not to flag any bit or character variable that is initialized to or assigned a constant value that is too long if the excess bits are all zeros (or if the excess characters are all blank).
MULTICLOSE or NOMULTICLOSE
NOMULTICLOSE causes the compiler to flag all statements that force the closure of multiple groups of statement with an E-level message.
PADDING|NOPADDING
Specifying NOPADDING causes the compiler to flag all structures that contain padding.
PROCENDONLY|NOPROCENDONLY
Specifying NOPROCENDONLY causes any END statement closing a PROCEDURE to be flagged if the END statement does not name the PROCEDURE, i.e. if the END keyword is immediately followed by a semicolon.
SELFASSIGN|NOSELFASSIGN
Specifying NOSELFASSIGN causes the compiler to flag all assignments where the source and the target are the same.

RULES(SELFASSIGN) is the default.

STOP|NOSTOP
Specifying NOSTOP causes all STOP and EXIT statements to be flagged.
UNREF or NOUNREF
Specifying NOUNREF causes the compiler to flag any level-1 AUTOMATIC variable which is not referenced and which, if it is a structure or union, contains no subelement which is referenced.

Default: RULES (IBM BYNAME NODECSIZE EVENDEC ELSEIF GOTO GLOBALDO NOLAXBIF NOLAXCTL LAXDCL NOLAXDEF LAXENTRY LAXIF LAXINOUT LAXLINK LAXPUNC LAXMARGINS LAXQUAL LAXRETURN LAXSCALE LAXSEMI LAXSTG NOLAXSTRZ MULTICLOSE PADDING PROCENDONLY SELFASSIGN STOP UNREF)

Rational Developer for System z
PL/I for Windows, Version 8.0, Programming Guide