This topic describes the built-in code
review rules that are supported for PL/I.
These rules are built into the Code Review for PL/I
component and do not require parameters. You can select these rules
from the Naming Conventions, Performance, and Program Structures categories
in the software analysis configuration editor. See Selecting the scope and the rules of a configuration.
- Naming Conventions:
- Use a main procedure name that matches the source file name
- Use this rule to flag a main procedure whose name does not match
the source file name.
- Performance:
- Avoid assigning or comparing two entry variables having different
parameter lists
- Use this rule to flag any assign or compare of two ENTRY variables
having different parameter description lists.
- Avoid assigning or comparing two entry variables having different
RETURNS attributes
- Use this rule to flag any assign or compare of two ENTRY variables
having different RETURNS attributes.
- Avoid declaring multiple data items by factoring attributes
- Use this rule to flag data declarations that declare multiple
data items by factoring attributes. For example: declare (A,B,C,D)
binary fixed (31);
- Avoid FIXED DECIMAL declarations with even precision
- Use this rule to flag any declaration of a FIXED DECIMAL variable
that specifies an even number of digits.
- Avoid implicit declarations
- Use this rule to flag references to data items that are not explicitly
declared.
- Declare a single variable in an IF, WHILE, UNTIL, or WHEN clause
as BIT(1) NONVARYING
- Use this rule to flag any IF, WHILE, UNTIL, or WHEN clause consisting
of a single variable that is not declared as BIT(1) NONVARYING.
- EXEC SQL: Avoid SELECT *
- Use this rule to flag EXEC SQL statements that contain SELECT
*.
- EXEC SQL: Use unqualified table names
- Use this rule to flag any EXEC SQL statement containing a table
name that is qualified or that is not explicitly specified.
- Use a loop control variable that is FIXED BINARY, FLOAT, ORDINAL,
HANDLE, POINTER, or OFFSET
- Use this rule to flag any loop condition whose loop variable is
not FIXED BINARY, FLOAT, ORDINAL, HANDLE, POINTER, or OFFSET.
- Use INITIAL with STATIC data declarations
- Use this rule to flag data declarations that contain the STATIC
attribute but not the INITIAL attribute.
- Program Structures:
- Avoid assigning a value to an INONLY or NONASSIGNABLE parameter
- Use this rule to flag any statement that assigns a value to an
INONLY or NONASSIGNABLE procedure parameter.
- Avoid GO TO statements that specify a label in another block
- Use this rule to flag all GO TO statements that specify a label
in another block.
- Avoid GO TO statements that specify a label variable
- Use this rule to flag any GO TO statement that specifies a label
variable.
- Avoid most GO TO statements
- Use this rule to flag all GO TO statements, except GO TO statements
that transfer control out of a begin-block.
- Avoid STOP statements
- Use this rule to flag all STOP statements.
- EXEC CICS®: Use DFHRESP
to check the return value
- This rule applies to data items that are used as the RESP or RESP2
parameter of an EXEC CICS command.
Use
this rule to flag a comparison between such a data item and anything
other than the return value of a DFHRESP function call, in the following
contexts: (1) in any relation condition, and (2) in any WHEN unit
of a SELECT statement in which the data item is the selection subject.
- EXEC CICS: Use the RESP
option
- Use this rule to flag EXEC CICS commands that do not include the RESP
option.
This rule examines all EXEC CICS blocks and checks that a RESP() option
is present. If no option is present, the block is flagged as a violation.
- Initialize locator variables used for based storage
- Use this rule to flag all references to a based data item for
which the locator variable might not have been initialized.
This
rule concludes that the locator variable might not have been initialized
if all the following conditions are true: (1) An INIT attribute is
not specified for the locator variable, or INIT(NULL) or INIT(SYSNULL)
is specified; (2) No assignment statement sets the value of the locator
variable; (3) No allocate statement explicitly or implicitly sets
the value of the locator variable; (4) No allocate statement sets
the value for any data item that uses the locator variable as a base.
This
rule does not flag a reference to the based data that is an input
parameter of the SIZE or STORAGE built-in function.
- Use a SELECT statement rather than ELSE-IF
- Use this rule to flag any IF statement containing an ELSE-unit
in which ELSE is immediately followed by another IF statement.
Note
that the IF statement is not flagged if it is contained within another
IF statement that has already been flagged for a rule violation.
- Use dot qualified references to structure members that are not
level 1
- Use this rule to flag non-dot-qualified references to structure
members that are not level 1.