COBOL is likely to continue to be a primary language for implementing
batch programs at least for the next several years. If we are
to make efficient use of this tool, we must also adapt efficient
programming techniques using this language. In order to do this,
we must drop some of the obsolete programming practices that we
have historically continued.
During over 20 years of industrial programming experience,
the author has had the opportunity to both write many COBOL programs
and to help many others with their COBOL problems. During this
time he has observed many programming practices which tend to
hinder program development and maintenance. In general, people
who practice good programming tend to write programs which are
logically shorter, i.e. use more concise logic, and to discard
obsolete constructs that only increase the wordiness of the program.
These programs are generally both quicker to code, easier to
debug, and easier to maintain later.
Through the development of this paper, the author hopes to
encode enough of these rules so that others may benefit and begin
to develop better programs.
Some of these rules are minor and may seem not worth mentioning.
However, they are all instances of a larger issue - that extraneous
code in a program, when it does not contribute to either the efficiency
of the program or to the understanding of it, is costly (1) in
the additional time
needed to create the code, (2) in the potential mistakes made
while coding it that will increase the number of compile or test
runs necessary to correct it, and (3) in the additional time needed
to read through it by the maintenance programmer.
Other of these rules, particularly those on control structures
in the PROCEDURE DIVISION, are of major importance. Knowing the
proper coding constructs to handle common situations and the pitfalls
of some of the historical ones can drastically reduce these same
three time consumers mentioned above.