Jump to content

COBOL

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by Jerome Cobol (talk | contribs) at 15:41, 21 April 2007 (Defense). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

COBOL
Paradigmmulti-paradigm
Designed byGrace Hopper, William Selden, Gertrude Tierney, Howard Bromberg, Howard Discount, Vernon Reeves, Jean E. Sammet
First appeared1959
Stable release
COBOL 2002 / 2002
Typing disciplinestrong, static
Major implementations
http://www.opencobol.org/
Dialects
IBM OS/VS COBOL, IBM COBOL/II, IBM COBOL SAA, IBM Enterprise COBOL, IBM COBOL/400, IBM ILE COBOL, Unix COBOL X/Open, Micro Focus COBOL, Microsoft COBOL, Ryan McFarland RM/COBOL, Ryan McFarland RM/COBOL-85, DOSVS COBOL, UNIVAC COBOL, Realia COBOL, Fujitsu COBOL, ACUCOBOL-GT, DEC VAX COBOL, Wang VS COBOL
Influenced by
FLOW-MATIC, COMTRAN
Influenced
PL/I

COBOL (pronounced 'COE-bol') is a third-generation programming language, and one of the oldest programming languages still in active use. 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.

History 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 Zürich ALGOL 58 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:

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 on January 3 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 (produced by USASI, USA Standards Inst., later called ANSI)
  • COBOL-74
  • COBOL-85
  • COBOL-89 (First Addendum to ANS COBOL 85)
  • COBOL 2002


  1. ANS COBOL 89 was released to include Intrinsic Functions (IF) in the COBOL language. The syntax and symantics for IF's had been defined in the late 1970's (by CODASYL), but just missed the "cut-off" dead-line date for inclusion in ANS COBOL 85. No one expected COBOL 85 to take so long after COBOL 74. The delay made the exclusion of Intrinsic Functions even more "painful." The solution was to produce COBOL-89 as an addendum to COBOL-85, so the COBOL community would not need to wait for the subsequent fully revised COBOL-2002. (See Reference below, "Functions Illustrated")

Defining features

Behind all of COBOL's features is its Readability and Maintainability. That is, COBOL was (is) to be used when designing systems that will "live" for some period of time and will likely need to be maintained (added to, changed, deleted from) over the years (multiple generations of maintenance programmers). What many call a verbose language is meant to be a more maintainable language. Much of the Y2K crisis is a result of the success of COBOL as a maintainable language for (business) systems. Few systems designers actually believed that the COBOL programs written in the 1960's, 1970's, and even the 1980's would still be running in production at their respective IT sites at the turn of the millennium. And while giving much credit for the Y2K crisis to COBOL, it's only right to give credit to COBOL for the Y2K NON-CRISIS. The lack of a catastrophe, as many predicted, was a result of the searchability and maintainability of those legacy COBOL systems. (JG)

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 infamous "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 POSIX families (Unix/Linux etc.). In 1997, the Gartner Group reported that 80% of the world's business ran on COBOL with 180 billion lines of code in existence and with an estimated 5 billion lines of new code annually.[1]

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.
       PROCEDURE DIVISION.
       PARA-1.
           DISPLAY "Hello, world.".
           STOP RUN.


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 and Turing Award recipient Edsger Dijkstra remarked that "The use of COBOL cripples the mind; its teaching should, therefore, be regarded as a criminal offense" (from Selected Writings on Computing: A Personal Perspective).

COBOL 85 was not compatible with earlier versions, resulting in the "cesarean birth of COBOL 85". Joseph T. Brophy, CIO, Travelers Insurance, spearheaded an effort to inform users of COBOL of the heavy reprogramming costs of implementing the new standard. As a result the ANSI COBOL Committee received more than 3,200 letters from the public, mostly negative, requiring the committee to make changes. Template:Ref harvard

Older versions of COBOL lack local variables and so cannot truly support structured programming.

Others criticize the ad hoc incorporation of features on a language that was meant to be a short term solution to interoperability in 1959. Coupled with the perceived archaic syntax, they argue that it tries to fill a niche for which better tools have already been designed and developed.

Defense

"In application development, clever programming is not a virtue - clear programming is." (JG) No industrial strength programming language beats COBOL for creating well-maintainable systems - on ANY platform, mainframe and PC.

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).[citation needed]

The COBOL specification has also been revised over the years to incorporate developments in computing theory and practice .

As with any language, COBOL code can be made more verbose than necessary. For example the COBOL code for one of the roots

of the quadratic equation ax2 + bx + c = 0 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.

Newer versions of COBOL support local variables via embedded programs (scope-delimited by the keywords PROGRAM-ID and END-PROGRAM). Variables declared within the embedded program are invisible outside its scope. In older versions of COBOL local variables may be hidden by using sub-programs, which must be invoked (via the keyword CALL). The calling program will not have access to the variables declared and manipulated by the sub-program. This technique could result in an unwieldy mass of sub-programs, particularly if those are not well documented.

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.

Alternative expansions of the COBOL acronym have been suggested:

  • Compiles Only Because Of Luck
  • Compiles Only By Odd Luck
  • Completely Obsolete Business Oriented Language
  • Completely Obsolete Boring Old Language

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 completely conforming compiler.

Trivia

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.
  • Sammet, J.E.& Garfunkel, Jerome (1985). "Summary of Changes in COBOL, 1960-1985" In Annals of the History of Computing IEEE
  • Edsger W. Dijkstra How do we tell truths that might hurt?
  • Garfunkel, Jerome Functions Illustrated
  • ^ Garfunkel, Jerome. "Caesarean Birth of COBOL 85". The COBOL 85 Example Book. United States and Canada: John Wiley & Sons. ISBN 0-471-80461-4.
  1. ^ "Future of COBOL" (PDF). LegacyJ Corporation. 2003. p. 5. Retrieved 2006-11-08.