COBOL

The Television & Movie Wiki: for TV, celebrities, and movies.

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. However, most of this article is based on COBOL 85.

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 in May 1959, organized by Charles Phillips of the United States Department of Defense. 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, and the IBM COMTRAN language invented by Bob Bemer.

The specifications were approved by the full Short Range Committee. From there, they 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. COBOL was developed within a six month period, and yet is still in use over 40 years later.

Defining features

COBOL as defined in the original specification, possessed excellent self-documenting capabilities, good file handling methods, and exceptionally good data typing for the time, owing to its use of the PICTURE clause for detailed field specification. However, until the 1985 Standard, it had serious flaws by modern standards for programming language definition, notably of support for local variables, recursion, dynamic memory allocation, and structured programming. Its perceived lack of explicit support for object-oriented programming is understandable, given that the concept was unknown at the time. However sufficient standard COBOL constructs, even in the 1974 Standard, allowed a company to produce an object like framework totally in COBOL that predated C++, (Netron Frames, 1986).

COBOL also has many reserved words, called keywords. The original COBOL specification even supported self-modifying code via the famous "ALTER X TO PROCEED TO Y" statement. However, the COBOL specification has been redefined over the years to address some of these criticisms, and later definitions of COBOL have remedied many of these lacks, adding improved control structures, object-orientation and removing the ability to use self-modifying code.

Still going strong

COBOL programs are in use globally in governmental and military agencies, in all major commercial enterprises (even though COBOL was originally proposed simply to achieve governmental programming commonality), and on almost all significant operating systems (desktop and above) including the common ones such as IBM's z/OS, Microsoft's Windows, and the Unix/Linux families. The global code base is vast and from time to time applications are subject to review for enhancement or replacement. The expense of rewriting a COBOL application, that has already been debugged, in a different new language has not always been found worth any benefits that might ensue. 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.

Near the end of the twentieth century there was a flurry of activity for COBOL programmers fixing the year 2000 problem, sometimes in systems the same programmers had designed decades before. This problem was especially prevalent in COBOL code because dates are relevant in business applications, and most existing business applications were written in COBOL.

COBOL supports various forms of number representations, including BCD binary-coded decimal which was mandated at times by accountants for business applications. Some people think that the use of BCD arithmetic in their application's design happened to make programs designed without provision for the advent of the 2000s particularly vulnerable to failure with the year 2000 problem because it might encourage storing the year as two decimal digits. Others argue that COBOL's decimal fixed-point arithmetic support avoided many other problems that can occur with the naïve use of floating point for financial calculations.

COBOL has proven to be durable and adaptable. The current standard for COBOL is COBOL2002. COBOL2002 supports contemporary conveniences such as Unicode, XML generation and parsing, calling conventions to/from non-COBOL languages such as C, inclusion as a first class language in framework environments such as Microsoft's .NET, and the ability to interoperate in closed framework environments such as Java, (including COBOL instantiated as EJBs).

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.

Opposing views on COBOL

All computer languages have their advocates and detractors. 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.

Criticism

A motivation of COBOL's design was to make programming easier by making the language as English-like as possible. While this idea seems reasonable on its face, in practice the most difficult task in programming is reducing a complex computation to a sequence of simple steps, not specifying those steps with a particular language. Nevertheless, critics had argued that COBOL's verbose syntax serves mainly to increase the size of programs, and that it impaired the development of the thinking process needed for software development. However, these same people do not generate business applications, they develop computer languages. Computer scientist Edsger Dijkstra remarked in his repudiated 1975 letter to an editor "How do we tell truths that might hurt?", "The use of COBOL cripples the mind; its teaching should, therefore, be regarded as a criminal offence." But Dijkstra was also positively impressed by Michael A. Jackson's ideas about "Structured Programming" in COBOL (Jackson Structured Programming).

The SQL language, which follows COBOL's philosophy but is not used to write procedural code, has not faced as much criticism about its syntax.

Some programmers joke that the object-oriented extension of COBOL should be called ADD 1 TO COBOL GIVING COBOL. This is by analogy with C++, a pun on C's syntax for incrementing a variable in place, and it highlights the verbosity of COBOL's syntax compared to C. The joke is that in C++, the instruction to increase a variable named "C" by one is C++ (or C=C+1), returning the original value of C whereas it takes the longer form in COBOL.

Defense

On the other hand, COBOL is not one of the approximately 4000 academic languages. It is a business language used globally. Advocates claim that typically those who criticize the language have never been COBOL programmers and often misrepresent it. As software technology advances, COBOL incorporates the strong and proven developments. All computer fads have produced some good ideas along with a lot of failed ideas. This includes the CASE era of the 1980s which was supposed to eliminate the programmer, the OO era of the 1990s which was supposed to minimize code redundancy and prevent runtime aborts, and the MDA era beginning around 2000, which is supposed to eliminate the programmer and computer languages altogether. The charter of COBOL to provide functionality while maintaining reliability and stability in applications will always be challenged by language advocates with another way to do something - "one more function".

As far as COBOL's syntax, in almost all modern COBOL implementations, the compilers are not case sensitive, although the compiler will capitalize all keywords prior to parsing.

If one wants to make COBOL more verbose than it has to be, one usually can. For example the COBOL code for the quadratic equation


<math> x=\frac{-b \pm \sqrt {b^2-4ac\ }}{2a}. </math>


can be written, using the "compute" verb, which can handle quite complex and deeply-nested statements in algebraic form, like this:

      COMPUTE X = (-B + (B ** 2 - (4 * A * C)) **.5) / (2 * A)


or this:

      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.

See also

Other third-generation programming languages:

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.

Books

External links

Major programming languages (more) (edit)

Industrial: ABAP | Ada | AWK | Assembly | Coldfusion | C | C++ | C# | COBOL | Common Lisp | Delphi | Eiffel | Fortran | Java | JavaScript | Lisp | Objective-C | Pascal | Perl | PHP | PL/SQL | PowerBuilder | Python | Ruby | SAS | Smalltalk | T-SQL | Tcl | Visual Basic | VB.NET | Visual FoxPro

Academic: APL/J | Haskell | Logo | ML | Prolog | Scheme

Historical: ALGOL | BASIC | Clipper | Modula-2/Modula-3 | MUMPS | PL/I | Simula

cs:COBOL

da:COBOL de:COBOL es:COBOL eo:COBOL fr:Cobol gl:Cobol ko:코볼 hr:Cobol ia:COBOL it:COBOL he:COBOL lt:Cobol hu:COBOL programozási nyelv nl:COBOL ja:COBOL no:COBOL pl:COBOL pt:COBOL ru:КОБОЛ sk:COBOL fi:COBOL sv:COBOL tr:COBOL uk:Кобол

Retrieved from "http://tvwiki.tv/wiki/COBOL"
Personal tools
Toolbox