Introduction to COBOL.
B.S.prakash Visitor Submitted Source Code
A very simple introduction to COBOL.
4185 Since 25th November, 2003
Select and Copy the Code
COBOL is a high-level programming language first developed by the
CODASYL Committee (Conference on Data Systems Languages) in 1960. Since
then, responsibility for developing new COBOL standards has been assumed
by the American National Standards Institute (ANSI).
Three ANSI standards for COBOL have been produced: in 1968, 1974 and 1985.
A new COBOL standard introducing object-oriented programming to COBOL, is
due within the next few years.
The word COBOL is an acronym that stands for COmmon Business Oriented
Language. As the the expanded acronym indicates, COBOL is designed for
developing business, typically file-oriented, applications. It is not
designed for writing systems programs. For instance you would not develop
an operating system or a compiler using COBOL.
For over four decades COBOL has been the dominant programming language in
the business computing domain. In that time it it has seen off the
challenges of a number of other languages such as PL1, Algol68, Pascal,
Modula, Ada, C, C++. All these languages have found a niche but none has
yet displaced COBOL. Two recent challengers though, Java and Visual Basic,
are proving to be serious contenders.
COBOL's dominance in underlined by the reports from the Gartner group.
In 1997 they estimated that there were about 300 billion lines of computer
code in use in the world. Of that they estimated that about 80% (240
billion lines) were in COBOL and 20% (60 billion lines) were written in
all the other computer languages combined [Brown].
In 1999 they reported that over 50% of all new mission-critical
applications were still being done in COBOL and their recent estimates
indicate that through 2004-2005 15% of all new applications (5 billion
lines) will be developed in COBOL while 80% of all deployed applications
will include extensions to existing legacy (usually COBOL) programs.
Gartner estimates for 2002 are that there are about two million COBOL
programmers world-wide compared to about about one million Java
programmers and one million C++ programmers.
COBOL is self-documenting
One of the design goals for COBOL was to make it possible for
non-programmers such as supervisors, managers and users, to read and
understand COBOL code. As a result, COBOL contains such English-like
structural elements as verbs, clauses, sentences, sections and divisions.
As it happens, this design goal was not realized. Managers and users
nowadays do not read COBOL programs. Computer programs are just too
complex for most laymen to understand them, however familiar the syntactic
elements. But the design goal and its effect on COBOL syntax has had one
important side-effect. It has made COBOL the most readable, understandable
and self-documenting programming language in use today. It has also made
it the most verbose.
It is easy for programmers unused to the business programming paradigm,
where programming with a view to ease of maintenance is very important, to
dismiss the advantage that COBOL's readability imparts. Not only does this
readability generally assist the maintenance process but the older a
program gets the more valuable this readability becomes.
When programs are new, both the in-program comments and the external
documentation accurately reflect the program code. But over time, as more
and more revisions are applied to the code, it gets out of step with the
documentation until the documentation is actually a hindrance to
maintenance rather than a help. The self-documenting nature of COBOL means
that this problem is not as severe with COBOL programs as it is with other
Readers who are familiar with C or C++ or Java might want to consider how
difficult it becomes to maintain programs written in these languages. C
programs that you have written yourself are difficult enough to understand
when you come back to them six months later. Consider how much more
difficult it would be to understand a program that had been written
fifteen years previously, by someone else, and which had since been
amended and added to by so many others that the documentation no longer
accurately reflects the program code. This is a nightmare still awaiting
maintenance programmers of the future
COBOL is simple
COBOL is a simple language (no pointers, no user defined functions, no
user defined types) with a limited scope of function. It encourages a
simple straightforward programming style. Curiously enough though, despite
its limitations, COBOL has proven itself to be well suited to its targeted
problem domain (business computing). Most COBOL programs operate in a
domain where the program complexity lies in the business rules that have
to be encoded rather than in the sophistication of the data structures or
algorithms required. And in cases where sophisticated algorithms are
required COBOL usually meets the need with an appropriate verb such as the
SORT and the SEARCH.