This topic describes the COBOL code review custom rule
templates in detail.
- Avoid CALL of user-definable routine
- This rule examines all CALL statements in a program. If the parameter
is a literal identifier, it is compared to the user supplied routine
name. If they match, the CALL statement is flagged as a violation.
- Avoid using the specified copybook
- This rule examines all COPY statements and checks the copybook
name against the supplied parameter. If they match, the COPY statement
is flagged as a violation.
- COBOL filename adheres to naming convention
- This rule takes the supplied parameter as a regular expression
and attempts to match it against the program’s file name. The expression
must have one match only, starting with the first character of the
filename and ending with the last. Any file extension is ignored.
Any program name that doesn’t match the regular expression is flagged
as a violation.
- To specify a naming convention wherein the file must begin with
prefix the required regular expression would be: ^prefix.*$
- To specify a naming convention wherein the file must begin with
prefix and end with an integer the required regular expression would
be: ^prefix[0-9]*^
- End clause required for various COBOL statements
- This rule examines IF/EVALUATE/READ/SEARCH/STRING statements,
according to which of these options is checked by the user. Any of
the statements found without an associated END phrase is marked as
a violation.
- In-line PERFORM statement cannot exceed custom line number limit
- This rule examines each inline PERFORM statement, counting the
lines between the first and last statements. If this number exceeds
the custom line limit, the PERFORM statement is flagged as a violation.
- Procedure division statements cannot exceed custom line number
limit
- This rule examines all PROCEDURE divisions, counting the lines
between the first and last statements. If this number exceeds the
custom line limit, the PROCEDURE division is flagged as a violation.