Rational Developer for System z
Enterprise PL/I for z/OS, Version 3.8, Programming Guide

RULES

The RULES option allows or disallows certain language capabilities and lets you 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-+-------------------------------+
               | .-NOLAXBIF-.                             |
               +-+-LAXBIF---+-----------------------------+
               | .-NOLAXCTL-.                             |
               +-+-LAXCTL---+-----------------------------+
               | .-LAXDCL---.                             |
               +-+-NOLAXDCL-+-----------------------------+
               | .-NOLAXDEF-.                             |
               +-+-LAXDEF---+-----------------------------+
               | .-LAXENTRY---.                           |
               +-+-NOLAXENTRY-+---------------------------+
               | .-LAXIF---.                              |
               +-+-NOLAXIF-+------------------------------+
               | .-LAXINOUT---.                           |
               +-+-NOLAXINOUT-+---------------------------+
               | .-LAXLINK---.                            |
               +-+-NOLAXLINK-+----------------------------+
               | .-LAXMARGINS---------------------------. |
               +-+-NOLAXMARGINS--+--------------------+-+-+
               |                 |    .-STRICT---.    |   |
               |                 '-(--+-XNUMERIC-+--)-'   |
               | .-LAXPUNC---.                            |
               +-+-NOLAXPUNC-+----------------------------+
               | .-LAXQUAL---.                            |
               +-+-NOLAXQUAL-+----------------------------+
               | .-LAXSEMI---.                            |
               +-+-NOLAXSEMI-+----------------------------+
               | .-LAXSTG---.                             |
               +-+-NOLAXSTG-+-----------------------------+
               | .-NOLAXSTRZ-.                            |
               +-+-LAXSTRZ---+----------------------------+
               | .-MULTICLOSE---.                         |
               +-+-NOMULTICLOSE-+-------------------------+
               | .-UNREF---.                              |
               '-+-NOUNREF-+------------------------------'
 

IBM | ANS
Under the IBM suboption:

Under the ANS suboption:

Also, under RULES(ANS), the following errors, which the old compilers ignored, will produce E-level messages

BYNAME | NOBYNAME
Specifying NOBYNAME causes the compiler to flag all BYNAME assignments with an E-level message.
DECSIZE | 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 | 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 | 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 | 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.
LAXCTL | 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 | NOLAXDCL
Specifying LAXDCL allows implicit declarations. NOLAXDCL disallows all implicit and contextual declarations except for BUILTINs and for files SYSIN and SYSPRINT.
LAXDEF | 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 | 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.
LAXIF | 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 | 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 | 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 | 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 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 fixed bin,
    2 c fixed bin;

c   = 15;   /* would be flagged */
a.c = 15;   /* would not be flagged */
LAXSEMI | NOLAXSEMI
Specifying NOLAXSEMI causes the compiler to flag any semicolons appearing inside comments.
LAXSTG | 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 | 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 | NOMULTICLOSE
NOMULTICLOSE causes the compiler to flag all statements that force the closure of multiple groups of statement with an E-level message.
UNREF | 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 NOLAXBIF NOLAXCTL LAXDCL NOLAXDEF LAXIF LAXINOUT LAXLINK LAXPUNC LAXMARGINS(STRICT) LAXQUAL LAXSEMI LAXSTG NOLAXSTRZ MULTICLOSE UNREF)


Terms of use | Feedback

This information center is powered by Eclipse technology. (http://www.eclipse.org)