RULE 6 - Specify only the minimum of information in the FD,
namely LABEL RECORD when the compiler still requires it, and BLOCK
CONTAINS 0 (used to designate that the JCL/file will contain the
real block size instead of the program).
Of the forty-five programs which had external files, eleven
had only the minimum of information in the FD. However, thirty-four
contained additional clauses. The most common clause was the
RECORDING MODE F clause, followed by the RECORD CONTAINS clause
and the DATA RECORD clause. As an independent check, the author
asked several programmers what the meaning of the RECORDING MODE
clause was. Half did not know, but simply assumed it was needed
since the programs they looked at all contained it, most others
guessed its function correctly (presumably by its parallel to
the RECFM=F clause in IBM JCL with which they are all familiar),
and only one indicated that he did not use it.
RULE 7 - Do not use the SYNCHRONIZED clause as it is no longer
necessary.
Fourteen out of fifty programs contained the SYNC clause.
All of these used it in combination with the COMP usage. In
addition, some used it as well on each 01 level in the FILE SECTION.
However, many programs did not contain any COMP usage, and thus
did not use this clause.
RULE 8 - Use the group/numeric field construct rather than
a REDEFINES for multiple field definitions needed in edit programs.
Forty-two out of the fifty programs did not do any editing,
and therefore did not need this construct. Of the remaining eight
programs, only two used the group/numeric construct, with the
remaining six using a REDEFINES clause. In addition, one program
did not use a REDEFINES clause, but should have had one. The
code in this program looked like the following:
IF field NOT NUMERIC
MOVE ... TO ERROR-NUMBER
PERFORM ERROR-ROUTINE
ELSE
NEXT SENTENCE.
IF field NEGATIVE
MOVE ... TO ERROR-NUMBER
PERFORM ERROR-ROUTINE
ELSE
NEXT SENTENCE.
If the field is not numeric, it should not be tested for numeric,
since this will cause a data exception.
RULE 9 - Unless a field is used in computations a large number
of times, or there are many numeric fields in a file, use the
USAGE mode that is most comfortable to you.
It appears that this rule is being followed. No pattern could
be detected for how the programmers decided which USAGE mode to
use. In some cases, subscripts were of DISPLAY usage and work
fields were COMP, in some cases everything was DISPLAY usage,
in other cases, there was a mixture of DISPLAY, COMP-3, and COMP.
In one program, the subscripts were DISPLAY usage, but the work
fields were COMP.
RULE 10 - Initialize global fields, such as program counters,
totals, and end-of-file switches with a VALUE clause, to avoid
forgetting the initializing MOVE statement later.
It also appears that this rule is being followed. Only four
of the fifty programs initialized global fields in the PROCEDURE
DIVISION. End-of-file switches appeared to be coded as "PIC
X VALUE 'N'." in nearly every program.