COBOL
From Wikipedia, the free encyclopedia
COBOL is a third-generation programming language. Its name is an acronym, for COmmon Business Oriented Language, defining its primary domain in business, finance, and administrative systems for companies and governments.
The COBOL 2002 standard includes support for object-oriented programming and other modern language features.
Contents |
Prehistory and specification
COBOL was initially created in 1959 by The Short Range Committee, one of three committees proposed at a meeting held at the Pentagon on May 28 and 29, 1959, organized by Charles Phillips of the United States Department of Defense (exactly one year after the Zurich ALGOL meeting). The Short Range Committee was formed to recommend a short range approach to a common business language. It was made up of members representing six computer manufacturers and three government agencies. In particular, the six computer manufacturers were Burroughs Corporation, IBM, Minneapolis-Honeywell (Honeywell Labs), RCA, Sperry Rand, and Sylvania Electric Products. The three government agencies were the US Air Force, the David Taylor Model Basin, and the National Bureau of Standards (Now NIST). This committee was chaired by a member of the NBS. An Intermediate-Range Committee and a Long-Range Committee were proposed at the Pentagon meeting as well. However although the Intermediate Range Committee was formed, it was never operational; and the Long-Range Committee was never even formed. In the end a sub-committee of the Short Range Committee developed the specifications of the COBOL language. This sub-committee was made up of six individuals:
- William Selden and Gertrude Tierney of IBM
- Howard Bromberg and Howard Discount of RCA
- Vernon Reeves and Jean E. Sammet of Sylvania Electric Products
This subcommittee completed the specifications for COBOL as the year of 1959 came to an end. The specifications were to a great extent inspired by the FLOW-MATIC language invented by Grace Hopper, commonly referred to as "the mother of the COBOL language, and the IBM COMTRAN language invented by Bob Bemer.
History of COBOL Standards
The specifications approved by the full Short Range Committee were approved by the Executive Committee in January 1960, and sent to the government printing office, which edited and printed these specifications as Cobol 60.
The American National Standards Institute (ANSI) has since produced several revisions of the COBOL standard, including
- COBOL-68
- COBOL-74
- COBOL-85
- COBOL 2002
In addition to the ANSI standards mentioned above, several dialects exist, including
- IBM OS/VS COBOL
- IBM COBOL/II
- IBM COBOL SAA
- Unix COBOL X/Open
- Micro Focus COBOL
- Microsoft COBOL
- Ryan McFarland RM/COBOL
- Ryan McFarland RM/COBOL-85
- DOSVS COBOL
- UNIVAC COBOL
- Fujitsu COBOL
Defining features
COBOL as defined in the original specification included a PICTURE clause for detailed field specification. It did not support local variables, recursion, dynamic memory allocation, or structured programming constructs. Support for some or all of these features has been added in later editions of the COBOL standard.
COBOL has many reserved words, called keywords. The original COBOL specification supported self-modifying code via the famous "ALTER X TO PROCEED TO Y" statement. This capability has since been removed.
COBOL legacy
COBOL programs are in use globally in governmental and military agencies, in commercial enterprises, and on operating systems such as IBM's z/OS, Microsoft's Windows, and the Unix/Linux families. In the late 1990s, the Gartner Group, a data-processing industry research organization, estimated that of the 300 billion lines of computer code that existed, eighty percent — or 240 billion lines — were COBOL. They also reported that more than half of all new mission-critical applications were still being created using COBOL — an estimated 5,000,000,000 net new lines of COBOL code annually.
Near the end of the twentieth century the year 2000 problem was the focus of significant COBOL programming effort, sometimes by the same programmers who had designed the systems decades before. The particular level of effort required for COBOL code has been attributed both to the large amount of business-oriented COBOL, as COBOL is by design a business language and business applications use dates heavily, and to constructs of the COBOL language such as the PICTURE clause, which can be used to define fixed-length numeric fields, including two-digit fields for years.
Hello world
IDENTIFICATION DIVISION. Program-Id. Hello-World. * ENVIRONMENT DIVISION. * DATA DIVISION. * PROCEDURE DIVISION. Para1. DISPLAY "Hello, world.". * Stop Run.
If you copy and paste this example then be careful to preserve the indentation, as indentation is relevant to (at least) older COBOL compilers. If you're trying to compile this example on an older compiler and it fails to compile or produces no output when run, you may want to try a more simple example.
Criticism
Critics have argued that COBOL's syntax serves mainly to increase the size of programs, at the expense of developing the thinking process needed for software development. In his letter to an editor in 1975 titled "How do we tell truths that might hurt?", Computer scientist Edsger Dijkstra remarked that "The use of COBOL cripples the mind; its teaching should, therefore, be regarded as a criminal offence"(from Selected Writings on Computing: A Personal Perspective).
Defense
Advocates claim that typically those who criticize the language have never been COBOL programmers and often misrepresent it. Critic Edsger Dijkstra was also positively impressed by Michael A. Jackson's ideas about "Structured Programming" in COBOL (Jackson Structured Programming).
The COBOL specification has also been revised over the years to incorporate developments in computing theory and practice .
As far as COBOL's syntax, modern COBOL compilers are generally not case sensitive, but will capitalize all keywords prior to parsing. The SQL language, which is also English-like but is not used to write procedural code, has not faced as much criticism about its syntax.
As with any notation, COBOL code can be made more verbose than necessary. For example the COBOL code for the quadratic equation
can be written, using the "compute" verb as:
COMPUTE X = (-B + (B ** 2 - (4 * A * C)) **.5) / (2 * A)
The same formula can also be written less concisely as:
MULTIPLY B BY B GIVING B-SQUARED. MULTIPLY 4 BY A GIVING FOUR-A. MULTIPLY FOUR-A BY C GIVING FOUR-A-C. SUBTRACT FOUR-A-C FROM B-SQUARED GIVING RESULT-1. COMPUTE RESULT-2 = RESULT-1 ** .5. SUBTRACT B FROM RESULT-2 GIVING NUMERATOR. MULTIPLY 2 BY A GIVING DENOMINATOR. DIVIDE NUMERATOR BY DENOMINATOR GIVING X.
It should be noted that due to compile-time optimising, replacing a
series of explicit arithmetic steps with a single COMPUTE statement can result
in unexpected imprecision, especially when the calculation involves the mixing
of REAL and INTEGER data types (as in this example) and is a primary reason not
to do it. This behaviour is of course machine and compiler dependent.
Aphorisms and humor about COBOL
It has been said of languages like C, C++, and Java that the only way to modify legacy code is to rewrite it - write once and write once again; or write once and throw away. On the other hand, it has been said of COBOL that there actually is one original COBOL program, and it only has been copied and modified millions of times.
The name "ADD 1 TO COBOL GIVING COBOL" has been suggested for a hypothetical object-oriented dialect of COBOL, as a play on the name C++. While this is meant to suggest that COBOL is inherently verbose, the form given is more verbose than COBOL actually requires. For example, "ADD 1 TO COBOL" is also valid COBOL and has the same effect.
An alternative expansion of the COBOL accronym has been suggested: Compiles Only Because Of Luck
COBOL 2002 and Object-Oriented COBOL
The COBOL2002 standard supports Unicode, XML generation and parsing, calling conventions to/from non-COBOL languages such as C, and support for execution within framework environments such as Microsoft's .NET and Java (including COBOL instantiated as EJBs).
However, no vendor has yet produced a conformant compiler.
See also
Other third-generation programming languages
Other
References
- Sammet, J.E. (1981). "The Early History of COBOL." In History of Programming Languages, by Wexelblat, R.L., ed. New York: ACM Monograph Series.
- Edsger W. Dijkstra How do we tell truths that might hurt?
External links
- COBOL FAQ
- COBOL.com - The COBOL Community
- COBOL-Standard Committee
- COBOL grammar and COBOL research
- COBOLPortal
- CobolReport.com
- The COBOL Center
- COBOL Tutorial
- COBOL Beginners Tutorial
- "All Things COBOL" webring
- COBOL User Groups (COBUG)
- IBM COBOL including Mainframe (zOS)
- COBOL & Mainframe related Discussion Group
- COBOL & Mainframe related Resources
- COBOL II Reference and Examples
Major programming languages (more/edit) | |||
Industrial: ABAP | Ada | AWK | Assembly | C | C++ | C# | COBOL | Common Lisp | ColdFusion | D | Delphi | Eiffel | Fortran | JADE | Java | JavaScript | Lua | Objective-C | Pascal | Perl | PHP | Python | REALbasic | REBOL | RPG | Ruby | SQL | Tcl | Visual Basic | VB.NET | Visual FoxPro
|