COBOL
Encyclopedia
COBOL is one of the oldest programming language
s. 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.
language invented by Grace Hopper
- commonly referred to as "the mother of the COBOL language." The IBM COMTRAN
language invented by Bob Bemer
was also drawn upon, but the FACT
language specification from Honeywell
was not distributed to committee members until late in the process and had relatively little impact. FLOW-MATIC
's status as the only language of the bunch to have actually been implemented made it particularly attractive to the committee.
The scene was set on April 8, 1959 at a meeting of computer manufacturers, users, and university people at the University of Pennsylvania
Computing Center. The United States Department of Defense
subsequently agreed to sponsor and oversee the next activities. A meeting chaired by Charles A. Phillips was held at the Pentagon
on May 28 and 29 of 1959 (exactly one year after the Zürich
ALGOL 58
meeting); there it was decided to set up three committees: short, intermediate and long range (the last one was never actually formed). It was the Short Range Committee, chaired by Joseph Wegstein of the US National Bureau of Standards, that during the following months created a description of the first version of COBOL. The committee was formed to recommend a short range approach to a common business language. The committee was made up of members representing six computer manufacturers and three government agencies. 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 Navy's David Taylor Model Basin
, and the National Bureau of Standards (now National Institute of Standards and Technology
). The intermediate-range committee was formed but never became operational. 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:
The decision to use the name "COBOL" was made at a meeting of the committee held on 18 September 1959. The subcommittee completed the specifications for COBOL in December 1959.
The first compilers for COBOL were subsequently implemented in 1960, and on December 6 and 7, essentially the same COBOL program ran on two different computer makes, an RCA computer and a Remington-Rand Univac
computer, demonstrating that compatibility could be achieved.
) developed a standard form of the language in 1968. This version was known as American National Standard (ANS) COBOL.
, Fujitsu
, Veryant, and IBM
) introduced object-oriented syntax based on the 1997 or other drafts of the full revision. The final approved ISO Standard (adopted as an ANSI standard by INCITS) was approved and made available in 2002.
Like the C++
and Java
programming languages, object-oriented COBOL compilers are available even as the language moves toward standardization. Fujitsu
and Micro Focus currently support object-oriented COBOL compilers targeting the .NET framework.
The 2002 (4th revision) of COBOL included many other features beyond object-orientation. These included (but are not limited to):
The American National Standards Institute
(ANSI) produced several revisions of the COBOL standard, including:
After the Amendments to the 1985 ANSI Standard (which were adopted by ISO), primary development and ownership was taken over by ISO. The following editions and TRs (Technical Reports) have been issued by ISO (and adopted as ANSI) Standards:
From 2002, the ISO standard is also available to the public coded as ISO/IEC 1989.
Work progresses on the next full revision of the COBOL Standard. Approval and availability was expected early 2010s. For information on this revision, to see the latest draft of this revision, or to see what other works is happening with the COBOL Standard, see the COBOL Standards Website.
, the POSIX
families (Unix
/Linux
etc.), and Microsoft's Windows
as well as ICL's VME operating system and Unisys
' OS 2200
. In 1997, the Gartner Group reported that 80% of the world's business ran on COBOL with over 200 billion lines of code in existence and with an estimated 5 billion lines of new 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. Because of the clean-up effort put into these COBOL programs for Y2K, many of them have been kept in use for years since then.
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 word
s (over 400), called keywords.
via the infamous "ALTER X TO PROCEED TO Y" statement. X and Y are paragraph labels, and any "GOTO X" statements executed after such an ALTER statement have the meaning "GOTO Y" instead. Most compilers still support it, but it should not be used in new programs.
ADD YEARS TO AGE
The equivalent construct in many procedural languages would be
age = age + years
This syntax is similar to the compound assignment operator later adopted by C:
age += years
The abbreviated conditional expression
IF SALARY > 8000 OR SUPERVISOR-SALARY OR = PREV-SALARY
is equivalent to
IF SALARY > 8000
OR SALARY > SUPERVISOR-SALARY
OR SALARY PREV-SALARY
COBOL provides "named conditions" (so-called 88-levels). These are declared as sub-items of another item (the conditional variable). The named condition can be used in an IF statement, and tests whether the conditional variable is equal to any of the values given in the named condition's VALUE clause. The SET statement can be used to make a named condition TRUE (by assigning the first of its values to the conditional variable).
COBOL allows identifiers up to 30 characters long. When COBOL was introduced, much shorter lengths (e.g., 6 characters for FORTRAN) were prevalent.
COBOL introduced the concept of copybooks
— chunks of code that can be inserted into a larger program. COBOL does this with the COPY statement, which also allows other code to replace parts of the copybook's code with other code (using the REPLACING ... BY ... clause).
s:
Most vendors provide additional types, such as:
IDENTIFICATION DIVISION.
PROGRAM-ID. HELLO-WORLD.
PROCEDURE DIVISION.
DISPLAY 'Hello, world'.
STOP RUN.
COBOL (icon) is one of the oldest programming language
s. 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
The COBOL specification was created by a committee of researchers from private industry, universities, and government during the second half of 1959. 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." The IBM COMTRAN
language invented by Bob Bemer
was also drawn upon, but the FACT
language specification from Honeywell
was not distributed to committee members until late in the process and had relatively little impact. FLOW-MATIC
's status as the only language of the bunch to have actually been implemented made it particularly attractive to the committee.
The scene was set on April 8, 1959 at a meeting of computer manufacturers, users, and university people at the University of Pennsylvania
Computing Center. The United States Department of Defense
subsequently agreed to sponsor and oversee the next activities. A meeting chaired by Charles A. Phillips was held at the Pentagon
on May 28 and 29 of 1959 (exactly one year after the Zürich
ALGOL 58
meeting); there it was decided to set up three committees: short, intermediate and long range (the last one was never actually formed). It was the Short Range Committee, chaired by Joseph Wegstein of the US National Bureau of Standards, that during the following months created a description of the first version of COBOL. The committee was formed to recommend a short range approach to a common business language. The committee was made up of members representing six computer manufacturers and three government agencies. 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 Navy's David Taylor Model Basin
, and the National Bureau of Standards (now National Institute of Standards and Technology
). The intermediate-range committee was formed but never became operational. 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:
The decision to use the name "COBOL" was made at a meeting of the committee held on 18 September 1959. The subcommittee completed the specifications for COBOL in December 1959.
The first compilers for COBOL were subsequently implemented in 1960, and on December 6 and 7, essentially the same COBOL program ran on two different computer makes, an RCA computer and a Remington-Rand Univac
computer, demonstrating that compatibility could be achieved.
) developed a standard form of the language in 1968. This version was known as American National Standard (ANS) COBOL.
, Fujitsu
, Veryant, and IBM
) introduced object-oriented syntax based on the 1997 or other drafts of the full revision. The final approved ISO Standard (adopted as an ANSI standard by INCITS) was approved and made available in 2002.
Like the C++
and Java
programming languages, object-oriented COBOL compilers are available even as the language moves toward standardization. Fujitsu
and Micro Focus currently support object-oriented COBOL compilers targeting the .NET framework.
The 2002 (4th revision) of COBOL included many other features beyond object-orientation. These included (but are not limited to):
The American National Standards Institute
(ANSI) produced several revisions of the COBOL standard, including:
After the Amendments to the 1985 ANSI Standard (which were adopted by ISO), primary development and ownership was taken over by ISO. The following editions and TRs (Technical Reports) have been issued by ISO (and adopted as ANSI) Standards:
From 2002, the ISO standard is also available to the public coded as ISO/IEC 1989.
Work progresses on the next full revision of the COBOL Standard. Approval and availability was expected early 2010s. For information on this revision, to see the latest draft of this revision, or to see what other works is happening with the COBOL Standard, see the COBOL Standards Website.
, the POSIX
families (Unix
/Linux
etc.), and Microsoft's Windows
as well as ICL's VME operating system and Unisys
' OS 2200
. In 1997, the Gartner Group reported that 80% of the world's business ran on COBOL with over 200 billion lines of code in existence and with an estimated 5 billion lines of new 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. Because of the clean-up effort put into these COBOL programs for Y2K, many of them have been kept in use for years since then.
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 word
s (over 400), called keywords.
via the infamous "ALTER X TO PROCEED TO Y" statement. X and Y are paragraph labels, and any "GOTO X" statements executed after such an ALTER statement have the meaning "GOTO Y" instead. Most compilers still support it, but it should not be used in new programs.
ADD YEARS TO AGE
The equivalent construct in many procedural languages would be
age = age + years
This syntax is similar to the compound assignment operator later adopted by C:
age += years
The abbreviated conditional expression
IF SALARY > 8000 OR SUPERVISOR-SALARY OR = PREV-SALARY
is equivalent to
IF SALARY > 8000
OR SALARY > SUPERVISOR-SALARY
OR SALARY PREV-SALARY
COBOL provides "named conditions" (so-called 88-levels). These are declared as sub-items of another item (the conditional variable). The named condition can be used in an IF statement, and tests whether the conditional variable is equal to any of the values given in the named condition's VALUE clause. The SET statement can be used to make a named condition TRUE (by assigning the first of its values to the conditional variable).
COBOL allows identifiers up to 30 characters long. When COBOL was introduced, much shorter lengths (e.g., 6 characters for FORTRAN) were prevalent.
COBOL introduced the concept of copybooks
— chunks of code that can be inserted into a larger program. COBOL does this with the COPY statement, which also allows other code to replace parts of the copybook's code with other code (using the REPLACING ... BY ... clause).
s:
Most vendors provide additional types, such as:
IDENTIFICATION DIVISION.
PROGRAM-ID. HELLO-WORLD.
PROCEDURE DIVISION.
DISPLAY 'Hello, world'.
STOP RUN.
COBOL (icon) is one of the oldest programming language
s. 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.
language invented by Grace Hopper
- commonly referred to as "the mother of the COBOL language." The IBM COMTRAN
language invented by Bob Bemer
was also drawn upon, but the FACT
language specification from Honeywell
was not distributed to committee members until late in the process and had relatively little impact. FLOW-MATIC
's status as the only language of the bunch to have actually been implemented made it particularly attractive to the committee.
The scene was set on April 8, 1959 at a meeting of computer manufacturers, users, and university people at the University of Pennsylvania
Computing Center. The United States Department of Defense
subsequently agreed to sponsor and oversee the next activities. A meeting chaired by Charles A. Phillips was held at the Pentagon
on May 28 and 29 of 1959 (exactly one year after the Zürich
ALGOL 58
meeting); there it was decided to set up three committees: short, intermediate and long range (the last one was never actually formed). It was the Short Range Committee, chaired by Joseph Wegstein of the US National Bureau of Standards, that during the following months created a description of the first version of COBOL. The committee was formed to recommend a short range approach to a common business language. The committee was made up of members representing six computer manufacturers and three government agencies. 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 Navy's David Taylor Model Basin
, and the National Bureau of Standards (now National Institute of Standards and Technology
). The intermediate-range committee was formed but never became operational. 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:
The decision to use the name "COBOL" was made at a meeting of the committee held on 18 September 1959. The subcommittee completed the specifications for COBOL in December 1959.
The first compilers for COBOL were subsequently implemented in 1960, and on December 6 and 7, essentially the same COBOL program ran on two different computer makes, an RCA computer and a Remington-Rand Univac
computer, demonstrating that compatibility could be achieved.
) developed a standard form of the language in 1968. This version was known as American National Standard (ANS) COBOL.
, Fujitsu
, Veryant, and IBM
) introduced object-oriented syntax based on the 1997 or other drafts of the full revision. The final approved ISO Standard (adopted as an ANSI standard by INCITS) was approved and made available in 2002.
Like the C++
and Java
programming languages, object-oriented COBOL compilers are available even as the language moves toward standardization. Fujitsu
and Micro Focus currently support object-oriented COBOL compilers targeting the .NET framework.
The 2002 (4th revision) of COBOL included many other features beyond object-orientation. These included (but are not limited to):
The American National Standards Institute
(ANSI) produced several revisions of the COBOL standard, including:
After the Amendments to the 1985 ANSI Standard (which were adopted by ISO), primary development and ownership was taken over by ISO. The following editions and TRs (Technical Reports) have been issued by ISO (and adopted as ANSI) Standards:
From 2002, the ISO standard is also available to the public coded as ISO/IEC 1989.
Work progresses on the next full revision of the COBOL Standard. Approval and availability was expected early 2010s. For information on this revision, to see the latest draft of this revision, or to see what other works is happening with the COBOL Standard, see the COBOL Standards Website.
, the POSIX
families (Unix
/Linux
etc.), and Microsoft's Windows
as well as ICL's VME operating system and Unisys
' OS 2200
. In 1997, the Gartner Group reported that 80% of the world's business ran on COBOL with over 200 billion lines of code in existence and with an estimated 5 billion lines of new 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. Because of the clean-up effort put into these COBOL programs for Y2K, many of them have been kept in use for years since then.
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 word
s (over 400), called keywords.
via the infamous "ALTER X TO PROCEED TO Y" statement. X and Y are paragraph labels, and any "GOTO X" statements executed after such an ALTER statement have the meaning "GOTO Y" instead. Most compilers still support it, but it should not be used in new programs.
ADD YEARS TO AGE
The equivalent construct in many procedural languages would be
age = age + years
This syntax is similar to the compound assignment operator later adopted by C:
age += years
The abbreviated conditional expression
IF SALARY > 8000 OR SUPERVISOR-SALARY OR = PREV-SALARY
is equivalent to
IF SALARY > 8000
OR SALARY > SUPERVISOR-SALARY
OR SALARY PREV-SALARY
COBOL provides "named conditions" (so-called 88-levels). These are declared as sub-items of another item (the conditional variable). The named condition can be used in an IF statement, and tests whether the conditional variable is equal to any of the values given in the named condition's VALUE clause. The SET statement can be used to make a named condition TRUE (by assigning the first of its values to the conditional variable).
COBOL allows identifiers up to 30 characters long. When COBOL was introduced, much shorter lengths (e.g., 6 characters for FORTRAN) were prevalent.
COBOL introduced the concept of copybooks
— chunks of code that can be inserted into a larger program. COBOL does this with the COPY statement, which also allows other code to replace parts of the copybook's code with other code (using the REPLACING ... BY ... clause).
s:
Most vendors provide additional types, such as:
IDENTIFICATION DIVISION.
PROGRAM-ID. HELLO-WORLD.
PROCEDURE DIVISION.
DISPLAY 'Hello, world'.
STOP RUN.
Like any wide-spread programming language, there are various dialects of COBOL. Some compilers, for example, allow the use of double quotes in addition to standard single quotes:
DISPLAY "Hello, world".
recipient Edsger Dijkstra
remarked that "The use of COBOL cripples the mind; its teaching should, therefore, be regarded as a criminal offense."
In his dissenting response to Dijkstra's article and the above "offensive statement," computer scientist Howard E. Tompkins defended structured COBOL: "COBOL programs with convoluted control flow indeed tend to 'cripple the mind'," but this was because "There are too many such business application programs written by programmers that have never had the benefit of structured COBOL taught well..."
Additionally, the introduction of OO-COBOL has added support for object-oriented
code as well as user-defined functions and user-defined data types to COBOL's repertoire.
, 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. On the other hand, conversion to COBOL 85 was thought to increase productivity in future years, thus justifying the conversion costs.
See also
Sources
External links
Standards:
Reference manuals:
Compilers and other products:
Programming language
A programming language is an artificial language designed to communicate instructions to a machine, particularly a computer. Programming languages can be used to create programs that control the behavior of a machine and/or to express algorithms precisely....
s. Its name is an acronym for COmmon Business-Oriented Language, defining its primary domain in business
Business
A business is an organization engaged in the trade of goods, services, or both to consumers. Businesses are predominant in capitalist economies, where most of them are privately owned and administered to earn profit to increase the wealth of their owners. Businesses may also be not-for-profit...
, finance, and administrative systems for companies and governments.
The COBOL 2002 standard includes support for object-oriented programming
Object-oriented programming
Object-oriented programming is a programming paradigm using "objects" – data structures consisting of data fields and methods together with their interactions – to design applications and computer programs. Programming techniques may include features such as data abstraction,...
and other modern language features.
History and specification
The COBOL specification was created by a committee of researchers from private industry, universities, and government during the second half of 1959. The specifications were to a great extent inspired by the FLOW-MATICFLOW-MATIC
FLOW-MATIC, originally known as B-0 , was the first English-like data processing language. It was developed for the UNIVAC I at Remington Rand under Grace Hopper.-Development:...
language invented by Grace Hopper
Grace Hopper
Rear Admiral Grace Murray Hopper was an American computer scientist and United States Navy officer. A pioneer in the field, she was one of the first programmers of the Harvard Mark I computer, and developed the first compiler for a computer programming language...
- commonly referred to as "the mother of the COBOL language." The IBM COMTRAN
COMTRAN
COMTRAN is an early programming language developed at IBM. It was intended as the business programming equivalent of the scientific programming language FORTRAN . It served as one of the forerunners to the COBOL language...
language invented by Bob Bemer
Bob Bemer
Robert William Bemer was a computer scientist best known for his work at IBM during the late 1950s and early 1960s.-Biography:...
was also drawn upon, but the FACT
FACT computer language
FACT was an early computer programming language, created by the Datamatic Division of Minneapolis Honeywell for its model 800 series business computers in 1959. FACT was an acronym for "Fully Automated Compiling Technique"...
language specification from Honeywell
Honeywell
Honeywell International, Inc. is a major conglomerate company that produces a variety of consumer products, engineering services, and aerospace systems for a wide variety of customers, from private consumers to major corporations and governments....
was not distributed to committee members until late in the process and had relatively little impact. FLOW-MATIC
FLOW-MATIC
FLOW-MATIC, originally known as B-0 , was the first English-like data processing language. It was developed for the UNIVAC I at Remington Rand under Grace Hopper.-Development:...
's status as the only language of the bunch to have actually been implemented made it particularly attractive to the committee.
The scene was set on April 8, 1959 at a meeting of computer manufacturers, users, and university people at the University of Pennsylvania
University of Pennsylvania
The University of Pennsylvania is a private, Ivy League university located in Philadelphia, Pennsylvania, United States. Penn is the fourth-oldest institution of higher education in the United States,Penn is the fourth-oldest using the founding dates claimed by each institution...
Computing Center. The United States Department of Defense
United States Department of Defense
The United States Department of Defense is the U.S...
subsequently agreed to sponsor and oversee the next activities. A meeting chaired by Charles A. Phillips was held at the Pentagon
The Pentagon
The Pentagon is the headquarters of the United States Department of Defense, located in Arlington County, Virginia. As a symbol of the U.S. military, "the Pentagon" is often used metonymically to refer to the Department of Defense rather than the building itself.Designed by the American architect...
on May 28 and 29 of 1959 (exactly one year after the Zürich
Zürich
Zurich is the largest city in Switzerland and the capital of the canton of Zurich. It is located in central Switzerland at the northwestern tip of Lake Zurich...
ALGOL 58
ALGOL 58
ALGOL 58, originally known as IAL, is one of the family of ALGOL computer programming languages. It was an early compromise design soon superseded by ALGOL 60...
meeting); there it was decided to set up three committees: short, intermediate and long range (the last one was never actually formed). It was the Short Range Committee, chaired by Joseph Wegstein of the US National Bureau of Standards, that during the following months created a description of the first version of COBOL. The committee was formed to recommend a short range approach to a common business language. The committee was made up of members representing six computer manufacturers and three government agencies. The six computer manufacturers were Burroughs Corporation, IBM
IBM
International Business Machines Corporation or IBM is an American multinational technology and consulting corporation headquartered in Armonk, New York, United States. IBM manufactures and sells computer hardware and software, and it offers infrastructure, hosting and consulting services in areas...
, Minneapolis-Honeywell
Honeywell
Honeywell International, Inc. is a major conglomerate company that produces a variety of consumer products, engineering services, and aerospace systems for a wide variety of customers, from private consumers to major corporations and governments....
(Honeywell Labs), RCA
RCA
RCA Corporation, founded as the Radio Corporation of America, was an American electronics company in existence from 1919 to 1986. The RCA trademark is currently owned by the French conglomerate Technicolor SA through RCA Trademark Management S.A., a company owned by Technicolor...
, Sperry Rand, and Sylvania Electric Products
Sylvania Electric Products
Sylvania Electric Products was a U.S. manufacturer of diverse electrical equipment, including at various times radio transceivers, vacuum tubes, semiconductors, and mainframe computers...
. The three government agencies were the US Air Force, the Navy's David Taylor Model Basin
David Taylor Model Basin
The David Taylor Model Basin is one of the largest ship model basins — test facilities for the development of ship design — in the world...
, and the National Bureau of Standards (now National Institute of Standards and Technology
National Institute of Standards and Technology
The National Institute of Standards and Technology , known between 1901 and 1988 as the National Bureau of Standards , is a measurement standards laboratory, otherwise known as a National Metrological Institute , which is a non-regulatory agency of the United States Department of Commerce...
). The intermediate-range committee was formed but never became operational. 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 IBMIBMInternational Business Machines Corporation or IBM is an American multinational technology and consulting corporation headquartered in Armonk, New York, United States. IBM manufactures and sells computer hardware and software, and it offers infrastructure, hosting and consulting services in areas...
- Howard Bromberg and Howard Discount of RCARCARCA Corporation, founded as the Radio Corporation of America, was an American electronics company in existence from 1919 to 1986. The RCA trademark is currently owned by the French conglomerate Technicolor SA through RCA Trademark Management S.A., a company owned by Technicolor...
- Vernon Reeves and Jean E. SammetJean E. SammetJean E. Sammet is an American computer scientist who developed the FORMAC programming language in 1962.She received her B.A. in Math from Mount Holyoke College in 1948 and her M.A. in Math from University of Illinois at Urbana-Champaign in 1949...
of Sylvania Electric ProductsSylvania Electric ProductsSylvania Electric Products was a U.S. manufacturer of diverse electrical equipment, including at various times radio transceivers, vacuum tubes, semiconductors, and mainframe computers...
The decision to use the name "COBOL" was made at a meeting of the committee held on 18 September 1959. The subcommittee completed the specifications for COBOL in December 1959.
The first compilers for COBOL were subsequently implemented in 1960, and on December 6 and 7, essentially the same COBOL program ran on two different computer makes, an RCA computer and a Remington-Rand Univac
UNIVAC
UNIVAC is the name of a business unit and division of the Remington Rand company formed by the 1950 purchase of the Eckert-Mauchly Computer Corporation, founded four years earlier by ENIAC inventors J. Presper Eckert and John Mauchly, and the associated line of computers which continues to this day...
computer, demonstrating that compatibility could be achieved.
ANS COBOL 1968
After 1959 COBOL underwent several modifications and improvements. In an attempt to overcome the problem of incompatibility between different versions of COBOL, the American National Standards Institute (ANSIAnsi
Ansi is a village in Kaarma Parish, Saare County, on the island of Saaremaa, Estonia....
) developed a standard form of the language in 1968. This version was known as American National Standard (ANS) COBOL.
COBOL 1974
In 1974, ANSI published a revised version of (ANS) COBOL, containing a number of features that were not in the 1968 version.COBOL 1985
In 1985, ANSI published still another revised version that had new features not in the 1974 standard, most notably structured language constructs ("scope terminators"), includingEND-IF
, END-PERFORM
, END-READ
, etc.COBOL 2002 and object-oriented COBOL
The language continues to evolve today. In the early 1990s it was decided to add object-orientation in the next full revision of COBOL. The initial estimate was to have this revision completed by 1997 and an ISO CD (Committee Draft) was available by 1997. Some implementers (including Micro FocusMicro Focus International
Micro Focus International plc is a multinational software and information technology business based in Newbury, Berkshire, United Kingdom. The firm provides software and consultancy services for clients updating legacy systems to more modern platforms...
, Fujitsu
Fujitsu
is a Japanese multinational information technology equipment and services company headquartered in Tokyo, Japan. It is the world's third-largest IT services provider measured by revenues....
, Veryant, and IBM
IBM
International Business Machines Corporation or IBM is an American multinational technology and consulting corporation headquartered in Armonk, New York, United States. IBM manufactures and sells computer hardware and software, and it offers infrastructure, hosting and consulting services in areas...
) introduced object-oriented syntax based on the 1997 or other drafts of the full revision. The final approved ISO Standard (adopted as an ANSI standard by INCITS) was approved and made available in 2002.
Like the C++
C++
C++ is a statically typed, free-form, multi-paradigm, compiled, general-purpose programming language. It is regarded as an intermediate-level language, as it comprises a combination of both high-level and low-level language features. It was developed by Bjarne Stroustrup starting in 1979 at Bell...
and Java
Java (programming language)
Java is a programming language originally developed by James Gosling at Sun Microsystems and released in 1995 as a core component of Sun Microsystems' Java platform. The language derives much of its syntax from C and C++ but has a simpler object model and fewer low-level facilities...
programming languages, object-oriented COBOL compilers are available even as the language moves toward standardization. Fujitsu
Fujitsu
is a Japanese multinational information technology equipment and services company headquartered in Tokyo, Japan. It is the world's third-largest IT services provider measured by revenues....
and Micro Focus currently support object-oriented COBOL compilers targeting the .NET framework.
The 2002 (4th revision) of COBOL included many other features beyond object-orientation. These included (but are not limited to):
- National Language support (including but not limited to Unicode support)
- Locale-based processing
- User-defined functions
- CALL (and function) prototypesFunction prototypeA function prototype in C, Perl or C++ is a declaration of a function that omits the function body but does specify the function's return type, name, arity and argument types...
(for compile-time parameter checking) - Pointers and syntax for getting and freeing storage
- Calling conventions to and from non-COBOL languages such as CC (programming language)C is a general-purpose computer programming language developed between 1969 and 1973 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating system....
- Support for execution within framework environments such as Microsoft's .NET.NET FrameworkThe .NET Framework is a software framework that runs primarily on Microsoft Windows. It includes a large library and supports several programming languages which allows language interoperability...
and JavaJava (programming language)Java is a programming language originally developed by James Gosling at Sun Microsystems and released in 1995 as a core component of Sun Microsystems' Java platform. The language derives much of its syntax from C and C++ but has a simpler object model and fewer low-level facilities...
(including COBOL instantiated as Enterprise JavaBeanEnterprise JavaBeanEnterprise JavaBeans is a managed, server-side component architecture for modular construction of enterprise applications.The EJB specification is one of several Java APIs in the Java EE specification. EJB is a server-side model that encapsulates the business logic of an application...
s) - Bit and Boolean support
- “True” binary support (up until this enhancement, binary items were truncated based on the (base-10) specification within the Data Division)
- Floating-point support
- Standard (or portable) arithmetic results
- XMLXMLExtensible Markup Language is a set of rules for encoding documents in machine-readable form. It is defined in the XML 1.0 Specification produced by the W3C, and several other related specifications, all gratis open standards....
generation and parsing
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
American National Standards Institute
The American National Standards Institute is a private non-profit organization that oversees the development of voluntary consensus standards for products, services, processes, systems, and personnel in the United States. The organization also coordinates U.S. standards with international...
(ANSI) produced several revisions of the COBOL standard, including:
- COBOL-68
- COBOL-74
- COBOL-85
- Intrinsic Functions Amendment - 1989
- Corrections Amendment - 1991
After the Amendments to the 1985 ANSI Standard (which were adopted by ISO), primary development and ownership was taken over by ISO. The following editions and TRs (Technical Reports) have been issued by ISO (and adopted as ANSI) Standards:
- COBOL 2002
- Finalizer Technical Report - 2003
- Native XML syntax Technical Report - 2006
- Object Oriented Collection Class Libraries - pending final approval...
From 2002, the ISO standard is also available to the public coded as ISO/IEC 1989.
Work progresses on the next full revision of the COBOL Standard. Approval and availability was expected early 2010s. For information on this revision, to see the latest draft of this revision, or to see what other works is happening with the COBOL Standard, see the COBOL Standards Website.
Legacy
COBOL programs are in use globally in governmental and military agencies and in commercial enterprises, and are running on operating systems such as IBM's z/OSZ/OS
z/OS is a 64-bit operating system for mainframe computers, produced by IBM. It derives from and is the successor to OS/390, which in turn followed a string of MVS versions.Starting with earliest:*OS/VS2 Release 2 through Release 3.8...
, the POSIX
POSIX
POSIX , an acronym for "Portable Operating System Interface", is a family of standards specified by the IEEE for maintaining compatibility between operating systems...
families (Unix
Unix
Unix is a multitasking, multi-user computer operating system originally developed in 1969 by a group of AT&T employees at Bell Labs, including Ken Thompson, Dennis Ritchie, Brian Kernighan, Douglas McIlroy, and Joe Ossanna...
/Linux
Linux
Linux is a Unix-like computer operating system assembled under the model of free and open source software development and distribution. The defining component of any Linux system is the Linux kernel, an operating system kernel first released October 5, 1991 by Linus Torvalds...
etc.), and Microsoft's Windows
Microsoft Windows
Microsoft Windows is a series of operating systems produced by Microsoft.Microsoft introduced an operating environment named Windows on November 20, 1985 as an add-on to MS-DOS in response to the growing interest in graphical user interfaces . Microsoft Windows came to dominate the world's personal...
as well as ICL's VME operating system and Unisys
Unisys
Unisys Corporation , headquartered in Blue Bell, Pennsylvania, United States, and incorporated in Delaware, is a long established business whose core products now involves computing and networking.-History:...
' OS 2200
Unisys OS 2200 operating system
OS 2200 is the operating system currently used for the Unisys ClearPath Dorado family of mainframe systems. OS 2200 is a lineal descendant of Exec 8 for the UNIVAC 1108. The name Exec 8 was shorthand for “Executive System for the UNIVAC 1108.” The UNIVAC 1108 computer was announced in 1964 and...
. In 1997, the Gartner Group reported that 80% of the world's business ran on COBOL with over 200 billion lines of code in existence and with an estimated 5 billion lines of new code annually.
Near the end of the twentieth century the year 2000 problem
Year 2000 problem
The Year 2000 problem was a problem for both digital and non-digital documentation and data storage situations which resulted from the practice of abbreviating a four-digit year to two digits.In computer programs, the practice of representing the year with two...
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. Because of the clean-up effort put into these COBOL programs for Y2K, many of them have been kept in use for years since then.
Features
COBOL as defined in the original specification included a PICTURE clausePicture clause
A picture clause is an element in programming languages that is used to describe a datum, by using sample characters that indicate the item characteristics and size.- History :...
for detailed field specification. It did not support local variables, recursion, dynamic memory allocation, or structured programming
Structured programming
Structured programming is a programming paradigm aimed on improving the clarity, quality, and development time of a computer program by making extensive use of subroutines, block structures and for and while loops - in contrast to using simple tests and jumps such as the goto statement which could...
constructs. Support for some or all of these features has been added in later editions of the COBOL standard. COBOL has many reserved word
Reserved word
Reserved words are one type of grammatical construct in programming languages. These words have special meaning within the language and are predefined in the language’s formal specifications...
s (over 400), called keywords.
Self-modifying code
The original COBOL specification supported self-modifying codeSelf-modifying code
In computer science, self-modifying code is code that alters its own instructions while it is executing - usually to reduce the instruction path length and improve performance or simply to reduce otherwise repetitively similar code, thus simplifying maintenance...
via the infamous "ALTER X TO PROCEED TO Y" statement. X and Y are paragraph labels, and any "GOTO X" statements executed after such an ALTER statement have the meaning "GOTO Y" instead. Most compilers still support it, but it should not be used in new programs.
Syntactic features
COBOL provides an update-in-place syntax, for exampleADD YEARS TO AGE
The equivalent construct in many procedural languages would be
age = age + years
This syntax is similar to the compound assignment operator later adopted by C:
age += years
The abbreviated conditional expression
IF SALARY > 8000 OR SUPERVISOR-SALARY OR = PREV-SALARY
is equivalent to
IF SALARY > 8000
OR SALARY > SUPERVISOR-SALARY
OR SALARY PREV-SALARY
COBOL provides "named conditions" (so-called 88-levels). These are declared as sub-items of another item (the conditional variable). The named condition can be used in an IF statement, and tests whether the conditional variable is equal to any of the values given in the named condition's VALUE clause. The SET statement can be used to make a named condition TRUE (by assigning the first of its values to the conditional variable).
COBOL allows identifiers up to 30 characters long. When COBOL was introduced, much shorter lengths (e.g., 6 characters for FORTRAN) were prevalent.
COBOL introduced the concept of copybooks
Copybook (programming)
A copybook is a section of code written in a high-level programming language or assembly language that can be copied and inserted into several different programs...
— chunks of code that can be inserted into a larger program. COBOL does this with the COPY statement, which also allows other code to replace parts of the copybook's code with other code (using the REPLACING ... BY ... clause).
Data types
Standard COBOL provides the following data typeData type
In computer programming, a data type is a classification identifying one of various types of data, such as floating-point, integer, or Boolean, that determines the possible values for that type; the operations that can be done on values of that type; the meaning of the data; and the way values of...
s:
Data type | Sample declaration | Notes |
---|---|---|
Character | PIC |
Alphanumeric and alphabetic-only Single-byte character set (SBCS) |
Edited character | PIC X99BAXX |
Formatted and inserted characters |
Numeric fixed-point binary | PIC S999V99 or BINARY |
Binary 16, 32, or 64 bits (2, 4, or 8 bytes) Signed or unsigned. Conforming compilers limit the maximum value of variables based on the picture clause and not the number of bits reserved for storage. |
Numeric fixed-point packed decimal | PIC S999V99 |
1 to 18 decimal digits (1 to 10 bytes) Signed or unsigned |
Numeric fixed-point zoned decimal | PIC S999V99 |
1 to 18 decimal digits (1 to 18 bytes) Signed or unsigned Leading or trailing sign, overpunch or separate |
Numeric floating-point | PIC S9V999ES99 |
Binary floating-point |
Edited numeric | PIC +Z,ZZ9.99 |
Formatted characters and digits |
Group (record Record (computer science) In computer science, a record is an instance of a product of primitive data types called a tuple. In C it is the compound data in a struct. Records are among the simplest data structures. A record is a value that contains other values, typically in fixed number and sequence and typically indexed... ) |
01 CUST-NAME. |
Aggregated elements |
Table Table (information) A table is a means of arranging data in rows and columns.Production % of goalNorth 4087102%South 4093110% The use of tables is pervasive throughout all communication, research and data analysis. Tables appear in print media, handwritten notes, computer software, architectural... (array Array data type In computer science, an array type is a data type that is meant to describe a collection of elements , each selected by one or more indices that can be computed at run time by the program. Such a collection is usually called an array variable, array value, or simply array... ) |
OCCURS 12 TIMES |
Fixed-size array, row-major order Up to 7 dimensions |
Variable-length table Variable-length array In programming, a variable-length array is an array data structure of automatic storage duration whose length is determined at run time .... |
OCCURS 0 to 12 TIMES |
Variable-sized array, row-major order Up to 7 dimensions |
Renames (variant or union Union (computer science) In computer science, a union is a value that may have any of several representations or formats; or a data structure that consists of a variable which may hold such a value. Some programming languages support special data types, called union types, to describe such values and variables... data) |
66 RAW-RECORD |
Character data overlaying other variables |
Condition name | 88 IS-RETIRED-AGE |
Boolean value dependent upon another variable |
Array index | [USAGE] INDEX |
Array subscript |
Most vendors provide additional types, such as:
Data type | Sample declaration | Notes |
---|---|---|
Numeric floating-point single precision |
PIC S9V9999999ES99 [USAGE] COMPUTATIONAL-1 |
Binary floating-point (32 bits, 7+ digits) (IBM extension) |
Numeric floating-point double precision |
PIC S9V999ES99 [USAGE] COMPUTATIONAL-2 |
Binary floating-point (64 bits, 16+ digits) (IBM extension) |
Numeric fixed-point packed decimal |
PIC S9V999 [USAGE] COMPUTATIONAL-3 |
same as PACKED DECIMAL (IBM extension) |
Numeric fixed-point binary | PIC S999V99 |
same as COMPUTATIONAL or BINARY (IBM extension) |
Numeric fixed-point binary (native binary) |
PIC S999V99 |
Binary 16, 32, or 64 bits (2, 4, or 8 bytes) Signed or unsigned. The maximum value of variables based on the number of bits reserved for storage and not on the picture clause. (IBM extension) |
Numeric fixed-point binary in native byte order |
PIC S999V99 |
Binary 16, 32, or 64 bits (2, 4, or 8 bytes) Signed or unsigned |
Numeric fixed-point binary in big-endian byte order |
PIC S999V99 |
Binary 16, 32, or 64 bits (2, 4, or 8 bytes) Signed or unsigned |
Wide character | PIC G(20) |
Alphanumeric Double-byte character set (DBCS) |
Edited wide character | PIC G99BGGG |
Formatted and inserted wide characters |
Edited floating-point | PIC +9.9(6)E+99 |
Formatted characters, decimal digits, and exponent |
Data pointer | [USAGE] POINTER |
Data memory address |
Code pointer Function pointer A function pointer is a type of pointer in C, C++, D, and other C-like programming languages, and Fortran 2003. When dereferenced, a function pointer can be used to invoke a function and pass it arguments just like a normal function... |
[USAGE] PROCEDURE-POINTER |
Code memory address |
Bit field | PIC 1(n) [USAGE] COMPUTATIONAL-5 |
n can be from 1 to 64, defining an n-bit integer Signed or unsigned |
Index | [USAGE] INDEX |
Binary value corresponding to an occurrence of a table element May be linked to a specific table using INDEXED BY |
Hello, world
An example of the "Hello, world" program in COBOL:IDENTIFICATION DIVISION.
PROGRAM-ID. HELLO-WORLD.
PROCEDURE DIVISION.
DISPLAY 'Hello, world'.
STOP RUN.
COBOL (icon) is one of the oldest programming language
Programming language
A programming language is an artificial language designed to communicate instructions to a machine, particularly a computer. Programming languages can be used to create programs that control the behavior of a machine and/or to express algorithms precisely....
s. Its name is an acronym for COmmon Business-Oriented Language, defining its primary domain in business
Business
A business is an organization engaged in the trade of goods, services, or both to consumers. Businesses are predominant in capitalist economies, where most of them are privately owned and administered to earn profit to increase the wealth of their owners. Businesses may also be not-for-profit...
, finance, and administrative systems for companies and governments.
The COBOL 2002 standard includes support for object-oriented programming
Object-oriented programming
Object-oriented programming is a programming paradigm using "objects" – data structures consisting of data fields and methods together with their interactions – to design applications and computer programs. Programming techniques may include features such as data abstraction,...
and other modern language features.
History and specification
The COBOL specification was created by a committee of researchers from private industry, universities, and government during the second half of 1959. The specifications were to a great extent inspired by the FLOW-MATIC
FLOW-MATIC
FLOW-MATIC, originally known as B-0 , was the first English-like data processing language. It was developed for the UNIVAC I at Remington Rand under Grace Hopper.-Development:...
language invented by Grace Hopper
Grace Hopper
Rear Admiral Grace Murray Hopper was an American computer scientist and United States Navy officer. A pioneer in the field, she was one of the first programmers of the Harvard Mark I computer, and developed the first compiler for a computer programming language...
- commonly referred to as "the mother of the COBOL language." The IBM COMTRAN
COMTRAN
COMTRAN is an early programming language developed at IBM. It was intended as the business programming equivalent of the scientific programming language FORTRAN . It served as one of the forerunners to the COBOL language...
language invented by Bob Bemer
Bob Bemer
Robert William Bemer was a computer scientist best known for his work at IBM during the late 1950s and early 1960s.-Biography:...
was also drawn upon, but the FACT
FACT computer language
FACT was an early computer programming language, created by the Datamatic Division of Minneapolis Honeywell for its model 800 series business computers in 1959. FACT was an acronym for "Fully Automated Compiling Technique"...
language specification from Honeywell
Honeywell
Honeywell International, Inc. is a major conglomerate company that produces a variety of consumer products, engineering services, and aerospace systems for a wide variety of customers, from private consumers to major corporations and governments....
was not distributed to committee members until late in the process and had relatively little impact. FLOW-MATIC
FLOW-MATIC
FLOW-MATIC, originally known as B-0 , was the first English-like data processing language. It was developed for the UNIVAC I at Remington Rand under Grace Hopper.-Development:...
's status as the only language of the bunch to have actually been implemented made it particularly attractive to the committee.
The scene was set on April 8, 1959 at a meeting of computer manufacturers, users, and university people at the University of Pennsylvania
University of Pennsylvania
The University of Pennsylvania is a private, Ivy League university located in Philadelphia, Pennsylvania, United States. Penn is the fourth-oldest institution of higher education in the United States,Penn is the fourth-oldest using the founding dates claimed by each institution...
Computing Center. The United States Department of Defense
United States Department of Defense
The United States Department of Defense is the U.S...
subsequently agreed to sponsor and oversee the next activities. A meeting chaired by Charles A. Phillips was held at the Pentagon
The Pentagon
The Pentagon is the headquarters of the United States Department of Defense, located in Arlington County, Virginia. As a symbol of the U.S. military, "the Pentagon" is often used metonymically to refer to the Department of Defense rather than the building itself.Designed by the American architect...
on May 28 and 29 of 1959 (exactly one year after the Zürich
Zürich
Zurich is the largest city in Switzerland and the capital of the canton of Zurich. It is located in central Switzerland at the northwestern tip of Lake Zurich...
ALGOL 58
ALGOL 58
ALGOL 58, originally known as IAL, is one of the family of ALGOL computer programming languages. It was an early compromise design soon superseded by ALGOL 60...
meeting); there it was decided to set up three committees: short, intermediate and long range (the last one was never actually formed). It was the Short Range Committee, chaired by Joseph Wegstein of the US National Bureau of Standards, that during the following months created a description of the first version of COBOL. The committee was formed to recommend a short range approach to a common business language. The committee was made up of members representing six computer manufacturers and three government agencies. The six computer manufacturers were Burroughs Corporation, IBM
IBM
International Business Machines Corporation or IBM is an American multinational technology and consulting corporation headquartered in Armonk, New York, United States. IBM manufactures and sells computer hardware and software, and it offers infrastructure, hosting and consulting services in areas...
, Minneapolis-Honeywell
Honeywell
Honeywell International, Inc. is a major conglomerate company that produces a variety of consumer products, engineering services, and aerospace systems for a wide variety of customers, from private consumers to major corporations and governments....
(Honeywell Labs), RCA
RCA
RCA Corporation, founded as the Radio Corporation of America, was an American electronics company in existence from 1919 to 1986. The RCA trademark is currently owned by the French conglomerate Technicolor SA through RCA Trademark Management S.A., a company owned by Technicolor...
, Sperry Rand, and Sylvania Electric Products
Sylvania Electric Products
Sylvania Electric Products was a U.S. manufacturer of diverse electrical equipment, including at various times radio transceivers, vacuum tubes, semiconductors, and mainframe computers...
. The three government agencies were the US Air Force, the Navy's David Taylor Model Basin
David Taylor Model Basin
The David Taylor Model Basin is one of the largest ship model basins — test facilities for the development of ship design — in the world...
, and the National Bureau of Standards (now National Institute of Standards and Technology
National Institute of Standards and Technology
The National Institute of Standards and Technology , known between 1901 and 1988 as the National Bureau of Standards , is a measurement standards laboratory, otherwise known as a National Metrological Institute , which is a non-regulatory agency of the United States Department of Commerce...
). The intermediate-range committee was formed but never became operational. 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 IBMIBMInternational Business Machines Corporation or IBM is an American multinational technology and consulting corporation headquartered in Armonk, New York, United States. IBM manufactures and sells computer hardware and software, and it offers infrastructure, hosting and consulting services in areas...
- Howard Bromberg and Howard Discount of RCARCARCA Corporation, founded as the Radio Corporation of America, was an American electronics company in existence from 1919 to 1986. The RCA trademark is currently owned by the French conglomerate Technicolor SA through RCA Trademark Management S.A., a company owned by Technicolor...
- Vernon Reeves and Jean E. SammetJean E. SammetJean E. Sammet is an American computer scientist who developed the FORMAC programming language in 1962.She received her B.A. in Math from Mount Holyoke College in 1948 and her M.A. in Math from University of Illinois at Urbana-Champaign in 1949...
of Sylvania Electric ProductsSylvania Electric ProductsSylvania Electric Products was a U.S. manufacturer of diverse electrical equipment, including at various times radio transceivers, vacuum tubes, semiconductors, and mainframe computers...
The decision to use the name "COBOL" was made at a meeting of the committee held on 18 September 1959. The subcommittee completed the specifications for COBOL in December 1959.
The first compilers for COBOL were subsequently implemented in 1960, and on December 6 and 7, essentially the same COBOL program ran on two different computer makes, an RCA computer and a Remington-Rand Univac
UNIVAC
UNIVAC is the name of a business unit and division of the Remington Rand company formed by the 1950 purchase of the Eckert-Mauchly Computer Corporation, founded four years earlier by ENIAC inventors J. Presper Eckert and John Mauchly, and the associated line of computers which continues to this day...
computer, demonstrating that compatibility could be achieved.
ANS COBOL 1968
After 1959 COBOL underwent several modifications and improvements. In an attempt to overcome the problem of incompatibility between different versions of COBOL, the American National Standards Institute (ANSIAnsi
Ansi is a village in Kaarma Parish, Saare County, on the island of Saaremaa, Estonia....
) developed a standard form of the language in 1968. This version was known as American National Standard (ANS) COBOL.
COBOL 1974
In 1974, ANSI published a revised version of (ANS) COBOL, containing a number of features that were not in the 1968 version.COBOL 1985
In 1985, ANSI published still another revised version that had new features not in the 1974 standard, most notably structured language constructs ("scope terminators"), includingEND-IF
, END-PERFORM
, END-READ
, etc.COBOL 2002 and object-oriented COBOL
The language continues to evolve today. In the early 1990s it was decided to add object-orientation in the next full revision of COBOL. The initial estimate was to have this revision completed by 1997 and an ISO CD (Committee Draft) was available by 1997. Some implementers (including Micro FocusMicro Focus International
Micro Focus International plc is a multinational software and information technology business based in Newbury, Berkshire, United Kingdom. The firm provides software and consultancy services for clients updating legacy systems to more modern platforms...
, Fujitsu
Fujitsu
is a Japanese multinational information technology equipment and services company headquartered in Tokyo, Japan. It is the world's third-largest IT services provider measured by revenues....
, Veryant, and IBM
IBM
International Business Machines Corporation or IBM is an American multinational technology and consulting corporation headquartered in Armonk, New York, United States. IBM manufactures and sells computer hardware and software, and it offers infrastructure, hosting and consulting services in areas...
) introduced object-oriented syntax based on the 1997 or other drafts of the full revision. The final approved ISO Standard (adopted as an ANSI standard by INCITS) was approved and made available in 2002.
Like the C++
C++
C++ is a statically typed, free-form, multi-paradigm, compiled, general-purpose programming language. It is regarded as an intermediate-level language, as it comprises a combination of both high-level and low-level language features. It was developed by Bjarne Stroustrup starting in 1979 at Bell...
and Java
Java (programming language)
Java is a programming language originally developed by James Gosling at Sun Microsystems and released in 1995 as a core component of Sun Microsystems' Java platform. The language derives much of its syntax from C and C++ but has a simpler object model and fewer low-level facilities...
programming languages, object-oriented COBOL compilers are available even as the language moves toward standardization. Fujitsu
Fujitsu
is a Japanese multinational information technology equipment and services company headquartered in Tokyo, Japan. It is the world's third-largest IT services provider measured by revenues....
and Micro Focus currently support object-oriented COBOL compilers targeting the .NET framework.
The 2002 (4th revision) of COBOL included many other features beyond object-orientation. These included (but are not limited to):
- National Language support (including but not limited to Unicode support)
- Locale-based processing
- User-defined functions
- CALL (and function) prototypesFunction prototypeA function prototype in C, Perl or C++ is a declaration of a function that omits the function body but does specify the function's return type, name, arity and argument types...
(for compile-time parameter checking) - Pointers and syntax for getting and freeing storage
- Calling conventions to and from non-COBOL languages such as CC (programming language)C is a general-purpose computer programming language developed between 1969 and 1973 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating system....
- Support for execution within framework environments such as Microsoft's .NET.NET FrameworkThe .NET Framework is a software framework that runs primarily on Microsoft Windows. It includes a large library and supports several programming languages which allows language interoperability...
and JavaJava (programming language)Java is a programming language originally developed by James Gosling at Sun Microsystems and released in 1995 as a core component of Sun Microsystems' Java platform. The language derives much of its syntax from C and C++ but has a simpler object model and fewer low-level facilities...
(including COBOL instantiated as Enterprise JavaBeanEnterprise JavaBeanEnterprise JavaBeans is a managed, server-side component architecture for modular construction of enterprise applications.The EJB specification is one of several Java APIs in the Java EE specification. EJB is a server-side model that encapsulates the business logic of an application...
s) - Bit and Boolean support
- “True” binary support (up until this enhancement, binary items were truncated based on the (base-10) specification within the Data Division)
- Floating-point support
- Standard (or portable) arithmetic results
- XMLXMLExtensible Markup Language is a set of rules for encoding documents in machine-readable form. It is defined in the XML 1.0 Specification produced by the W3C, and several other related specifications, all gratis open standards....
generation and parsing
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
American National Standards Institute
The American National Standards Institute is a private non-profit organization that oversees the development of voluntary consensus standards for products, services, processes, systems, and personnel in the United States. The organization also coordinates U.S. standards with international...
(ANSI) produced several revisions of the COBOL standard, including:
- COBOL-68
- COBOL-74
- COBOL-85
- Intrinsic Functions Amendment - 1989
- Corrections Amendment - 1991
After the Amendments to the 1985 ANSI Standard (which were adopted by ISO), primary development and ownership was taken over by ISO. The following editions and TRs (Technical Reports) have been issued by ISO (and adopted as ANSI) Standards:
- COBOL 2002
- Finalizer Technical Report - 2003
- Native XML syntax Technical Report - 2006
- Object Oriented Collection Class Libraries - pending final approval...
From 2002, the ISO standard is also available to the public coded as ISO/IEC 1989.
Work progresses on the next full revision of the COBOL Standard. Approval and availability was expected early 2010s. For information on this revision, to see the latest draft of this revision, or to see what other works is happening with the COBOL Standard, see the COBOL Standards Website.
Legacy
COBOL programs are in use globally in governmental and military agencies and in commercial enterprises, and are running on operating systems such as IBM's z/OSZ/OS
z/OS is a 64-bit operating system for mainframe computers, produced by IBM. It derives from and is the successor to OS/390, which in turn followed a string of MVS versions.Starting with earliest:*OS/VS2 Release 2 through Release 3.8...
, the POSIX
POSIX
POSIX , an acronym for "Portable Operating System Interface", is a family of standards specified by the IEEE for maintaining compatibility between operating systems...
families (Unix
Unix
Unix is a multitasking, multi-user computer operating system originally developed in 1969 by a group of AT&T employees at Bell Labs, including Ken Thompson, Dennis Ritchie, Brian Kernighan, Douglas McIlroy, and Joe Ossanna...
/Linux
Linux
Linux is a Unix-like computer operating system assembled under the model of free and open source software development and distribution. The defining component of any Linux system is the Linux kernel, an operating system kernel first released October 5, 1991 by Linus Torvalds...
etc.), and Microsoft's Windows
Microsoft Windows
Microsoft Windows is a series of operating systems produced by Microsoft.Microsoft introduced an operating environment named Windows on November 20, 1985 as an add-on to MS-DOS in response to the growing interest in graphical user interfaces . Microsoft Windows came to dominate the world's personal...
as well as ICL's VME operating system and Unisys
Unisys
Unisys Corporation , headquartered in Blue Bell, Pennsylvania, United States, and incorporated in Delaware, is a long established business whose core products now involves computing and networking.-History:...
' OS 2200
Unisys OS 2200 operating system
OS 2200 is the operating system currently used for the Unisys ClearPath Dorado family of mainframe systems. OS 2200 is a lineal descendant of Exec 8 for the UNIVAC 1108. The name Exec 8 was shorthand for “Executive System for the UNIVAC 1108.” The UNIVAC 1108 computer was announced in 1964 and...
. In 1997, the Gartner Group reported that 80% of the world's business ran on COBOL with over 200 billion lines of code in existence and with an estimated 5 billion lines of new code annually.
Near the end of the twentieth century the year 2000 problem
Year 2000 problem
The Year 2000 problem was a problem for both digital and non-digital documentation and data storage situations which resulted from the practice of abbreviating a four-digit year to two digits.In computer programs, the practice of representing the year with two...
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. Because of the clean-up effort put into these COBOL programs for Y2K, many of them have been kept in use for years since then.
Features
COBOL as defined in the original specification included a PICTURE clause
Picture clause
A picture clause is an element in programming languages that is used to describe a datum, by using sample characters that indicate the item characteristics and size.- History :...
for detailed field specification. It did not support local variables, recursion, dynamic memory allocation, or structured programming
Structured programming
Structured programming is a programming paradigm aimed on improving the clarity, quality, and development time of a computer program by making extensive use of subroutines, block structures and for and while loops - in contrast to using simple tests and jumps such as the goto statement which could...
constructs. Support for some or all of these features has been added in later editions of the COBOL standard. COBOL has many reserved word
Reserved word
Reserved words are one type of grammatical construct in programming languages. These words have special meaning within the language and are predefined in the language’s formal specifications...
s (over 400), called keywords.
Self-modifying code
The original COBOL specification supported self-modifying codeSelf-modifying code
In computer science, self-modifying code is code that alters its own instructions while it is executing - usually to reduce the instruction path length and improve performance or simply to reduce otherwise repetitively similar code, thus simplifying maintenance...
via the infamous "ALTER X TO PROCEED TO Y" statement. X and Y are paragraph labels, and any "GOTO X" statements executed after such an ALTER statement have the meaning "GOTO Y" instead. Most compilers still support it, but it should not be used in new programs.
Syntactic features
COBOL provides an update-in-place syntax, for exampleADD YEARS TO AGE
The equivalent construct in many procedural languages would be
age = age + years
This syntax is similar to the compound assignment operator later adopted by C:
age += years
The abbreviated conditional expression
IF SALARY > 8000 OR SUPERVISOR-SALARY OR = PREV-SALARY
is equivalent to
IF SALARY > 8000
OR SALARY > SUPERVISOR-SALARY
OR SALARY PREV-SALARY
COBOL provides "named conditions" (so-called 88-levels). These are declared as sub-items of another item (the conditional variable). The named condition can be used in an IF statement, and tests whether the conditional variable is equal to any of the values given in the named condition's VALUE clause. The SET statement can be used to make a named condition TRUE (by assigning the first of its values to the conditional variable).
COBOL allows identifiers up to 30 characters long. When COBOL was introduced, much shorter lengths (e.g., 6 characters for FORTRAN) were prevalent.
COBOL introduced the concept of copybooks
Copybook (programming)
A copybook is a section of code written in a high-level programming language or assembly language that can be copied and inserted into several different programs...
— chunks of code that can be inserted into a larger program. COBOL does this with the COPY statement, which also allows other code to replace parts of the copybook's code with other code (using the REPLACING ... BY ... clause).
Data types
Standard COBOL provides the following data typeData type
In computer programming, a data type is a classification identifying one of various types of data, such as floating-point, integer, or Boolean, that determines the possible values for that type; the operations that can be done on values of that type; the meaning of the data; and the way values of...
s:
Data type | Sample declaration | Notes |
---|---|---|
Character | PIC |
Alphanumeric and alphabetic-only Single-byte character set (SBCS) |
Edited character | PIC X99BAXX |
Formatted and inserted characters |
Numeric fixed-point binary | PIC S999V99 or BINARY |
Binary 16, 32, or 64 bits (2, 4, or 8 bytes) Signed or unsigned. Conforming compilers limit the maximum value of variables based on the picture clause and not the number of bits reserved for storage. |
Numeric fixed-point packed decimal | PIC S999V99 |
1 to 18 decimal digits (1 to 10 bytes) Signed or unsigned |
Numeric fixed-point zoned decimal | PIC S999V99 |
1 to 18 decimal digits (1 to 18 bytes) Signed or unsigned Leading or trailing sign, overpunch or separate |
Numeric floating-point | PIC S9V999ES99 |
Binary floating-point |
Edited numeric | PIC +Z,ZZ9.99 |
Formatted characters and digits |
Group (record Record (computer science) In computer science, a record is an instance of a product of primitive data types called a tuple. In C it is the compound data in a struct. Records are among the simplest data structures. A record is a value that contains other values, typically in fixed number and sequence and typically indexed... ) |
01 CUST-NAME. |
Aggregated elements |
Table Table (information) A table is a means of arranging data in rows and columns.Production % of goalNorth 4087102%South 4093110% The use of tables is pervasive throughout all communication, research and data analysis. Tables appear in print media, handwritten notes, computer software, architectural... (array Array data type In computer science, an array type is a data type that is meant to describe a collection of elements , each selected by one or more indices that can be computed at run time by the program. Such a collection is usually called an array variable, array value, or simply array... ) |
OCCURS 12 TIMES |
Fixed-size array, row-major order Up to 7 dimensions |
Variable-length table Variable-length array In programming, a variable-length array is an array data structure of automatic storage duration whose length is determined at run time .... |
OCCURS 0 to 12 TIMES |
Variable-sized array, row-major order Up to 7 dimensions |
Renames (variant or union Union (computer science) In computer science, a union is a value that may have any of several representations or formats; or a data structure that consists of a variable which may hold such a value. Some programming languages support special data types, called union types, to describe such values and variables... data) |
66 RAW-RECORD |
Character data overlaying other variables |
Condition name | 88 IS-RETIRED-AGE |
Boolean value dependent upon another variable |
Array index | [USAGE] INDEX |
Array subscript |
Most vendors provide additional types, such as:
Data type | Sample declaration | Notes |
---|---|---|
Numeric floating-point single precision |
PIC S9V9999999ES99 [USAGE] COMPUTATIONAL-1 |
Binary floating-point (32 bits, 7+ digits) (IBM extension) |
Numeric floating-point double precision |
PIC S9V999ES99 [USAGE] COMPUTATIONAL-2 |
Binary floating-point (64 bits, 16+ digits) (IBM extension) |
Numeric fixed-point packed decimal |
PIC S9V999 [USAGE] COMPUTATIONAL-3 |
same as PACKED DECIMAL (IBM extension) |
Numeric fixed-point binary | PIC S999V99 |
same as COMPUTATIONAL or BINARY (IBM extension) |
Numeric fixed-point binary (native binary) |
PIC S999V99 |
Binary 16, 32, or 64 bits (2, 4, or 8 bytes) Signed or unsigned. The maximum value of variables based on the number of bits reserved for storage and not on the picture clause. (IBM extension) |
Numeric fixed-point binary in native byte order |
PIC S999V99 |
Binary 16, 32, or 64 bits (2, 4, or 8 bytes) Signed or unsigned |
Numeric fixed-point binary in big-endian byte order |
PIC S999V99 |
Binary 16, 32, or 64 bits (2, 4, or 8 bytes) Signed or unsigned |
Wide character | PIC G(20) |
Alphanumeric Double-byte character set (DBCS) |
Edited wide character | PIC G99BGGG |
Formatted and inserted wide characters |
Edited floating-point | PIC +9.9(6)E+99 |
Formatted characters, decimal digits, and exponent |
Data pointer | [USAGE] POINTER |
Data memory address |
Code pointer Function pointer A function pointer is a type of pointer in C, C++, D, and other C-like programming languages, and Fortran 2003. When dereferenced, a function pointer can be used to invoke a function and pass it arguments just like a normal function... |
[USAGE] PROCEDURE-POINTER |
Code memory address |
Bit field | PIC 1(n) [USAGE] COMPUTATIONAL-5 |
n can be from 1 to 64, defining an n-bit integer Signed or unsigned |
Index | [USAGE] INDEX |
Binary value corresponding to an occurrence of a table element May be linked to a specific table using INDEXED BY |
Hello, world
An example of the "Hello, world" program in COBOL:IDENTIFICATION DIVISION.
PROGRAM-ID. HELLO-WORLD.
PROCEDURE DIVISION.
DISPLAY 'Hello, world'.
STOP RUN.
COBOL (icon) is one of the oldest programming language
Programming language
A programming language is an artificial language designed to communicate instructions to a machine, particularly a computer. Programming languages can be used to create programs that control the behavior of a machine and/or to express algorithms precisely....
s. Its name is an acronym for COmmon Business-Oriented Language, defining its primary domain in business
Business
A business is an organization engaged in the trade of goods, services, or both to consumers. Businesses are predominant in capitalist economies, where most of them are privately owned and administered to earn profit to increase the wealth of their owners. Businesses may also be not-for-profit...
, finance, and administrative systems for companies and governments.
The COBOL 2002 standard includes support for object-oriented programming
Object-oriented programming
Object-oriented programming is a programming paradigm using "objects" – data structures consisting of data fields and methods together with their interactions – to design applications and computer programs. Programming techniques may include features such as data abstraction,...
and other modern language features.
History and specification
The COBOL specification was created by a committee of researchers from private industry, universities, and government during the second half of 1959. The specifications were to a great extent inspired by the FLOW-MATICFLOW-MATIC
FLOW-MATIC, originally known as B-0 , was the first English-like data processing language. It was developed for the UNIVAC I at Remington Rand under Grace Hopper.-Development:...
language invented by Grace Hopper
Grace Hopper
Rear Admiral Grace Murray Hopper was an American computer scientist and United States Navy officer. A pioneer in the field, she was one of the first programmers of the Harvard Mark I computer, and developed the first compiler for a computer programming language...
- commonly referred to as "the mother of the COBOL language." The IBM COMTRAN
COMTRAN
COMTRAN is an early programming language developed at IBM. It was intended as the business programming equivalent of the scientific programming language FORTRAN . It served as one of the forerunners to the COBOL language...
language invented by Bob Bemer
Bob Bemer
Robert William Bemer was a computer scientist best known for his work at IBM during the late 1950s and early 1960s.-Biography:...
was also drawn upon, but the FACT
FACT computer language
FACT was an early computer programming language, created by the Datamatic Division of Minneapolis Honeywell for its model 800 series business computers in 1959. FACT was an acronym for "Fully Automated Compiling Technique"...
language specification from Honeywell
Honeywell
Honeywell International, Inc. is a major conglomerate company that produces a variety of consumer products, engineering services, and aerospace systems for a wide variety of customers, from private consumers to major corporations and governments....
was not distributed to committee members until late in the process and had relatively little impact. FLOW-MATIC
FLOW-MATIC
FLOW-MATIC, originally known as B-0 , was the first English-like data processing language. It was developed for the UNIVAC I at Remington Rand under Grace Hopper.-Development:...
's status as the only language of the bunch to have actually been implemented made it particularly attractive to the committee.
The scene was set on April 8, 1959 at a meeting of computer manufacturers, users, and university people at the University of Pennsylvania
University of Pennsylvania
The University of Pennsylvania is a private, Ivy League university located in Philadelphia, Pennsylvania, United States. Penn is the fourth-oldest institution of higher education in the United States,Penn is the fourth-oldest using the founding dates claimed by each institution...
Computing Center. The United States Department of Defense
United States Department of Defense
The United States Department of Defense is the U.S...
subsequently agreed to sponsor and oversee the next activities. A meeting chaired by Charles A. Phillips was held at the Pentagon
The Pentagon
The Pentagon is the headquarters of the United States Department of Defense, located in Arlington County, Virginia. As a symbol of the U.S. military, "the Pentagon" is often used metonymically to refer to the Department of Defense rather than the building itself.Designed by the American architect...
on May 28 and 29 of 1959 (exactly one year after the Zürich
Zürich
Zurich is the largest city in Switzerland and the capital of the canton of Zurich. It is located in central Switzerland at the northwestern tip of Lake Zurich...
ALGOL 58
ALGOL 58
ALGOL 58, originally known as IAL, is one of the family of ALGOL computer programming languages. It was an early compromise design soon superseded by ALGOL 60...
meeting); there it was decided to set up three committees: short, intermediate and long range (the last one was never actually formed). It was the Short Range Committee, chaired by Joseph Wegstein of the US National Bureau of Standards, that during the following months created a description of the first version of COBOL. The committee was formed to recommend a short range approach to a common business language. The committee was made up of members representing six computer manufacturers and three government agencies. The six computer manufacturers were Burroughs Corporation, IBM
IBM
International Business Machines Corporation or IBM is an American multinational technology and consulting corporation headquartered in Armonk, New York, United States. IBM manufactures and sells computer hardware and software, and it offers infrastructure, hosting and consulting services in areas...
, Minneapolis-Honeywell
Honeywell
Honeywell International, Inc. is a major conglomerate company that produces a variety of consumer products, engineering services, and aerospace systems for a wide variety of customers, from private consumers to major corporations and governments....
(Honeywell Labs), RCA
RCA
RCA Corporation, founded as the Radio Corporation of America, was an American electronics company in existence from 1919 to 1986. The RCA trademark is currently owned by the French conglomerate Technicolor SA through RCA Trademark Management S.A., a company owned by Technicolor...
, Sperry Rand, and Sylvania Electric Products
Sylvania Electric Products
Sylvania Electric Products was a U.S. manufacturer of diverse electrical equipment, including at various times radio transceivers, vacuum tubes, semiconductors, and mainframe computers...
. The three government agencies were the US Air Force, the Navy's David Taylor Model Basin
David Taylor Model Basin
The David Taylor Model Basin is one of the largest ship model basins — test facilities for the development of ship design — in the world...
, and the National Bureau of Standards (now National Institute of Standards and Technology
National Institute of Standards and Technology
The National Institute of Standards and Technology , known between 1901 and 1988 as the National Bureau of Standards , is a measurement standards laboratory, otherwise known as a National Metrological Institute , which is a non-regulatory agency of the United States Department of Commerce...
). The intermediate-range committee was formed but never became operational. 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 IBMIBMInternational Business Machines Corporation or IBM is an American multinational technology and consulting corporation headquartered in Armonk, New York, United States. IBM manufactures and sells computer hardware and software, and it offers infrastructure, hosting and consulting services in areas...
- Howard Bromberg and Howard Discount of RCARCARCA Corporation, founded as the Radio Corporation of America, was an American electronics company in existence from 1919 to 1986. The RCA trademark is currently owned by the French conglomerate Technicolor SA through RCA Trademark Management S.A., a company owned by Technicolor...
- Vernon Reeves and Jean E. SammetJean E. SammetJean E. Sammet is an American computer scientist who developed the FORMAC programming language in 1962.She received her B.A. in Math from Mount Holyoke College in 1948 and her M.A. in Math from University of Illinois at Urbana-Champaign in 1949...
of Sylvania Electric ProductsSylvania Electric ProductsSylvania Electric Products was a U.S. manufacturer of diverse electrical equipment, including at various times radio transceivers, vacuum tubes, semiconductors, and mainframe computers...
The decision to use the name "COBOL" was made at a meeting of the committee held on 18 September 1959. The subcommittee completed the specifications for COBOL in December 1959.
The first compilers for COBOL were subsequently implemented in 1960, and on December 6 and 7, essentially the same COBOL program ran on two different computer makes, an RCA computer and a Remington-Rand Univac
UNIVAC
UNIVAC is the name of a business unit and division of the Remington Rand company formed by the 1950 purchase of the Eckert-Mauchly Computer Corporation, founded four years earlier by ENIAC inventors J. Presper Eckert and John Mauchly, and the associated line of computers which continues to this day...
computer, demonstrating that compatibility could be achieved.
ANS COBOL 1968
After 1959 COBOL underwent several modifications and improvements. In an attempt to overcome the problem of incompatibility between different versions of COBOL, the American National Standards Institute (ANSIAnsi
Ansi is a village in Kaarma Parish, Saare County, on the island of Saaremaa, Estonia....
) developed a standard form of the language in 1968. This version was known as American National Standard (ANS) COBOL.
COBOL 1974
In 1974, ANSI published a revised version of (ANS) COBOL, containing a number of features that were not in the 1968 version.COBOL 1985
In 1985, ANSI published still another revised version that had new features not in the 1974 standard, most notably structured language constructs ("scope terminators"), includingEND-IF
, END-PERFORM
, END-READ
, etc.COBOL 2002 and object-oriented COBOL
The language continues to evolve today. In the early 1990s it was decided to add object-orientation in the next full revision of COBOL. The initial estimate was to have this revision completed by 1997 and an ISO CD (Committee Draft) was available by 1997. Some implementers (including Micro FocusMicro Focus International
Micro Focus International plc is a multinational software and information technology business based in Newbury, Berkshire, United Kingdom. The firm provides software and consultancy services for clients updating legacy systems to more modern platforms...
, Fujitsu
Fujitsu
is a Japanese multinational information technology equipment and services company headquartered in Tokyo, Japan. It is the world's third-largest IT services provider measured by revenues....
, Veryant, and IBM
IBM
International Business Machines Corporation or IBM is an American multinational technology and consulting corporation headquartered in Armonk, New York, United States. IBM manufactures and sells computer hardware and software, and it offers infrastructure, hosting and consulting services in areas...
) introduced object-oriented syntax based on the 1997 or other drafts of the full revision. The final approved ISO Standard (adopted as an ANSI standard by INCITS) was approved and made available in 2002.
Like the C++
C++
C++ is a statically typed, free-form, multi-paradigm, compiled, general-purpose programming language. It is regarded as an intermediate-level language, as it comprises a combination of both high-level and low-level language features. It was developed by Bjarne Stroustrup starting in 1979 at Bell...
and Java
Java (programming language)
Java is a programming language originally developed by James Gosling at Sun Microsystems and released in 1995 as a core component of Sun Microsystems' Java platform. The language derives much of its syntax from C and C++ but has a simpler object model and fewer low-level facilities...
programming languages, object-oriented COBOL compilers are available even as the language moves toward standardization. Fujitsu
Fujitsu
is a Japanese multinational information technology equipment and services company headquartered in Tokyo, Japan. It is the world's third-largest IT services provider measured by revenues....
and Micro Focus currently support object-oriented COBOL compilers targeting the .NET framework.
The 2002 (4th revision) of COBOL included many other features beyond object-orientation. These included (but are not limited to):
- National Language support (including but not limited to Unicode support)
- Locale-based processing
- User-defined functions
- CALL (and function) prototypesFunction prototypeA function prototype in C, Perl or C++ is a declaration of a function that omits the function body but does specify the function's return type, name, arity and argument types...
(for compile-time parameter checking) - Pointers and syntax for getting and freeing storage
- Calling conventions to and from non-COBOL languages such as CC (programming language)C is a general-purpose computer programming language developed between 1969 and 1973 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating system....
- Support for execution within framework environments such as Microsoft's .NET.NET FrameworkThe .NET Framework is a software framework that runs primarily on Microsoft Windows. It includes a large library and supports several programming languages which allows language interoperability...
and JavaJava (programming language)Java is a programming language originally developed by James Gosling at Sun Microsystems and released in 1995 as a core component of Sun Microsystems' Java platform. The language derives much of its syntax from C and C++ but has a simpler object model and fewer low-level facilities...
(including COBOL instantiated as Enterprise JavaBeanEnterprise JavaBeanEnterprise JavaBeans is a managed, server-side component architecture for modular construction of enterprise applications.The EJB specification is one of several Java APIs in the Java EE specification. EJB is a server-side model that encapsulates the business logic of an application...
s) - Bit and Boolean support
- “True” binary support (up until this enhancement, binary items were truncated based on the (base-10) specification within the Data Division)
- Floating-point support
- Standard (or portable) arithmetic results
- XMLXMLExtensible Markup Language is a set of rules for encoding documents in machine-readable form. It is defined in the XML 1.0 Specification produced by the W3C, and several other related specifications, all gratis open standards....
generation and parsing
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
American National Standards Institute
The American National Standards Institute is a private non-profit organization that oversees the development of voluntary consensus standards for products, services, processes, systems, and personnel in the United States. The organization also coordinates U.S. standards with international...
(ANSI) produced several revisions of the COBOL standard, including:
- COBOL-68
- COBOL-74
- COBOL-85
- Intrinsic Functions Amendment - 1989
- Corrections Amendment - 1991
After the Amendments to the 1985 ANSI Standard (which were adopted by ISO), primary development and ownership was taken over by ISO. The following editions and TRs (Technical Reports) have been issued by ISO (and adopted as ANSI) Standards:
- COBOL 2002
- Finalizer Technical Report - 2003
- Native XML syntax Technical Report - 2006
- Object Oriented Collection Class Libraries - pending final approval...
From 2002, the ISO standard is also available to the public coded as ISO/IEC 1989.
Work progresses on the next full revision of the COBOL Standard. Approval and availability was expected early 2010s. For information on this revision, to see the latest draft of this revision, or to see what other works is happening with the COBOL Standard, see the COBOL Standards Website.
Legacy
COBOL programs are in use globally in governmental and military agencies and in commercial enterprises, and are running on operating systems such as IBM's z/OSZ/OS
z/OS is a 64-bit operating system for mainframe computers, produced by IBM. It derives from and is the successor to OS/390, which in turn followed a string of MVS versions.Starting with earliest:*OS/VS2 Release 2 through Release 3.8...
, the POSIX
POSIX
POSIX , an acronym for "Portable Operating System Interface", is a family of standards specified by the IEEE for maintaining compatibility between operating systems...
families (Unix
Unix
Unix is a multitasking, multi-user computer operating system originally developed in 1969 by a group of AT&T employees at Bell Labs, including Ken Thompson, Dennis Ritchie, Brian Kernighan, Douglas McIlroy, and Joe Ossanna...
/Linux
Linux
Linux is a Unix-like computer operating system assembled under the model of free and open source software development and distribution. The defining component of any Linux system is the Linux kernel, an operating system kernel first released October 5, 1991 by Linus Torvalds...
etc.), and Microsoft's Windows
Microsoft Windows
Microsoft Windows is a series of operating systems produced by Microsoft.Microsoft introduced an operating environment named Windows on November 20, 1985 as an add-on to MS-DOS in response to the growing interest in graphical user interfaces . Microsoft Windows came to dominate the world's personal...
as well as ICL's VME operating system and Unisys
Unisys
Unisys Corporation , headquartered in Blue Bell, Pennsylvania, United States, and incorporated in Delaware, is a long established business whose core products now involves computing and networking.-History:...
' OS 2200
Unisys OS 2200 operating system
OS 2200 is the operating system currently used for the Unisys ClearPath Dorado family of mainframe systems. OS 2200 is a lineal descendant of Exec 8 for the UNIVAC 1108. The name Exec 8 was shorthand for “Executive System for the UNIVAC 1108.” The UNIVAC 1108 computer was announced in 1964 and...
. In 1997, the Gartner Group reported that 80% of the world's business ran on COBOL with over 200 billion lines of code in existence and with an estimated 5 billion lines of new code annually.
Near the end of the twentieth century the year 2000 problem
Year 2000 problem
The Year 2000 problem was a problem for both digital and non-digital documentation and data storage situations which resulted from the practice of abbreviating a four-digit year to two digits.In computer programs, the practice of representing the year with two...
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. Because of the clean-up effort put into these COBOL programs for Y2K, many of them have been kept in use for years since then.
Features
COBOL as defined in the original specification included a PICTURE clausePicture clause
A picture clause is an element in programming languages that is used to describe a datum, by using sample characters that indicate the item characteristics and size.- History :...
for detailed field specification. It did not support local variables, recursion, dynamic memory allocation, or structured programming
Structured programming
Structured programming is a programming paradigm aimed on improving the clarity, quality, and development time of a computer program by making extensive use of subroutines, block structures and for and while loops - in contrast to using simple tests and jumps such as the goto statement which could...
constructs. Support for some or all of these features has been added in later editions of the COBOL standard. COBOL has many reserved word
Reserved word
Reserved words are one type of grammatical construct in programming languages. These words have special meaning within the language and are predefined in the language’s formal specifications...
s (over 400), called keywords.
Self-modifying code
The original COBOL specification supported self-modifying codeSelf-modifying code
In computer science, self-modifying code is code that alters its own instructions while it is executing - usually to reduce the instruction path length and improve performance or simply to reduce otherwise repetitively similar code, thus simplifying maintenance...
via the infamous "ALTER X TO PROCEED TO Y" statement. X and Y are paragraph labels, and any "GOTO X" statements executed after such an ALTER statement have the meaning "GOTO Y" instead. Most compilers still support it, but it should not be used in new programs.
Syntactic features
COBOL provides an update-in-place syntax, for exampleADD YEARS TO AGE
The equivalent construct in many procedural languages would be
age = age + years
This syntax is similar to the compound assignment operator later adopted by C:
age += years
The abbreviated conditional expression
IF SALARY > 8000 OR SUPERVISOR-SALARY OR = PREV-SALARY
is equivalent to
IF SALARY > 8000
OR SALARY > SUPERVISOR-SALARY
OR SALARY PREV-SALARY
COBOL provides "named conditions" (so-called 88-levels). These are declared as sub-items of another item (the conditional variable). The named condition can be used in an IF statement, and tests whether the conditional variable is equal to any of the values given in the named condition's VALUE clause. The SET statement can be used to make a named condition TRUE (by assigning the first of its values to the conditional variable).
COBOL allows identifiers up to 30 characters long. When COBOL was introduced, much shorter lengths (e.g., 6 characters for FORTRAN) were prevalent.
COBOL introduced the concept of copybooks
Copybook (programming)
A copybook is a section of code written in a high-level programming language or assembly language that can be copied and inserted into several different programs...
— chunks of code that can be inserted into a larger program. COBOL does this with the COPY statement, which also allows other code to replace parts of the copybook's code with other code (using the REPLACING ... BY ... clause).
Data types
Standard COBOL provides the following data typeData type
In computer programming, a data type is a classification identifying one of various types of data, such as floating-point, integer, or Boolean, that determines the possible values for that type; the operations that can be done on values of that type; the meaning of the data; and the way values of...
s:
Data type | Sample declaration | Notes |
---|---|---|
Character | PIC |
Alphanumeric and alphabetic-only Single-byte character set (SBCS) |
Edited character | PIC X99BAXX |
Formatted and inserted characters |
Numeric fixed-point binary | PIC S999V99 or BINARY |
Binary 16, 32, or 64 bits (2, 4, or 8 bytes) Signed or unsigned. Conforming compilers limit the maximum value of variables based on the picture clause and not the number of bits reserved for storage. |
Numeric fixed-point packed decimal | PIC S999V99 |
1 to 18 decimal digits (1 to 10 bytes) Signed or unsigned |
Numeric fixed-point zoned decimal | PIC S999V99 |
1 to 18 decimal digits (1 to 18 bytes) Signed or unsigned Leading or trailing sign, overpunch or separate |
Numeric floating-point | PIC S9V999ES99 |
Binary floating-point |
Edited numeric | PIC +Z,ZZ9.99 |
Formatted characters and digits |
Group (record Record (computer science) In computer science, a record is an instance of a product of primitive data types called a tuple. In C it is the compound data in a struct. Records are among the simplest data structures. A record is a value that contains other values, typically in fixed number and sequence and typically indexed... ) |
01 CUST-NAME. |
Aggregated elements |
Table Table (information) A table is a means of arranging data in rows and columns.Production % of goalNorth 4087102%South 4093110% The use of tables is pervasive throughout all communication, research and data analysis. Tables appear in print media, handwritten notes, computer software, architectural... (array Array data type In computer science, an array type is a data type that is meant to describe a collection of elements , each selected by one or more indices that can be computed at run time by the program. Such a collection is usually called an array variable, array value, or simply array... ) |
OCCURS 12 TIMES |
Fixed-size array, row-major order Up to 7 dimensions |
Variable-length table Variable-length array In programming, a variable-length array is an array data structure of automatic storage duration whose length is determined at run time .... |
OCCURS 0 to 12 TIMES |
Variable-sized array, row-major order Up to 7 dimensions |
Renames (variant or union Union (computer science) In computer science, a union is a value that may have any of several representations or formats; or a data structure that consists of a variable which may hold such a value. Some programming languages support special data types, called union types, to describe such values and variables... data) |
66 RAW-RECORD |
Character data overlaying other variables |
Condition name | 88 IS-RETIRED-AGE |
Boolean value dependent upon another variable |
Array index | [USAGE] INDEX |
Array subscript |
Most vendors provide additional types, such as:
Data type | Sample declaration | Notes |
---|---|---|
Numeric floating-point single precision |
PIC S9V9999999ES99 [USAGE] COMPUTATIONAL-1 |
Binary floating-point (32 bits, 7+ digits) (IBM extension) |
Numeric floating-point double precision |
PIC S9V999ES99 [USAGE] COMPUTATIONAL-2 |
Binary floating-point (64 bits, 16+ digits) (IBM extension) |
Numeric fixed-point packed decimal |
PIC S9V999 [USAGE] COMPUTATIONAL-3 |
same as PACKED DECIMAL (IBM extension) |
Numeric fixed-point binary | PIC S999V99 |
same as COMPUTATIONAL or BINARY (IBM extension) |
Numeric fixed-point binary (native binary) |
PIC S999V99 |
Binary 16, 32, or 64 bits (2, 4, or 8 bytes) Signed or unsigned. The maximum value of variables based on the number of bits reserved for storage and not on the picture clause. (IBM extension) |
Numeric fixed-point binary in native byte order |
PIC S999V99 |
Binary 16, 32, or 64 bits (2, 4, or 8 bytes) Signed or unsigned |
Numeric fixed-point binary in big-endian byte order |
PIC S999V99 |
Binary 16, 32, or 64 bits (2, 4, or 8 bytes) Signed or unsigned |
Wide character | PIC G(20) |
Alphanumeric Double-byte character set (DBCS) |
Edited wide character | PIC G99BGGG |
Formatted and inserted wide characters |
Edited floating-point | PIC +9.9(6)E+99 |
Formatted characters, decimal digits, and exponent |
Data pointer | [USAGE] POINTER |
Data memory address |
Code pointer Function pointer A function pointer is a type of pointer in C, C++, D, and other C-like programming languages, and Fortran 2003. When dereferenced, a function pointer can be used to invoke a function and pass it arguments just like a normal function... |
[USAGE] PROCEDURE-POINTER |
Code memory address |
Bit field | PIC 1(n) [USAGE] COMPUTATIONAL-5 |
n can be from 1 to 64, defining an n-bit integer Signed or unsigned |
Index | [USAGE] INDEX |
Binary value corresponding to an occurrence of a table element May be linked to a specific table using INDEXED BY |
Hello, world
An example of the "Hello, world" program in COBOL:IDENTIFICATION DIVISION.
PROGRAM-ID. HELLO-WORLD.
PROCEDURE DIVISION.
DISPLAY 'Hello, world'.
STOP RUN.
Like any wide-spread programming language, there are various dialects of COBOL. Some compilers, for example, allow the use of double quotes in addition to standard single quotes:
DISPLAY "Hello, world".
Lack of structurability
In his letter to an editor in 1975 titled "How do we tell truths that might hurt?" which was critical of several programming languages contemporaneous with COBOL, computer scientist and Turing AwardTuring Award
The Turing Award, in full The ACM A.M. Turing Award, is an annual award given by the Association for Computing Machinery to "an individual selected for contributions of a technical nature made to the computing community. The contributions should be of lasting and major technical importance to the...
recipient Edsger Dijkstra
Edsger Dijkstra
Edsger Wybe Dijkstra ; ) was a Dutch computer scientist. He received the 1972 Turing Award for fundamental contributions to developing programming languages, and was the Schlumberger Centennial Chair of Computer Sciences at The University of Texas at Austin from 1984 until 2000.Shortly before his...
remarked that "The use of COBOL cripples the mind; its teaching should, therefore, be regarded as a criminal offense."
In his dissenting response to Dijkstra's article and the above "offensive statement," computer scientist Howard E. Tompkins defended structured COBOL: "COBOL programs with convoluted control flow indeed tend to 'cripple the mind'," but this was because "There are too many such business application programs written by programmers that have never had the benefit of structured COBOL taught well..."
Additionally, the introduction of OO-COBOL has added support for object-oriented
Object-oriented programming
Object-oriented programming is a programming paradigm using "objects" – data structures consisting of data fields and methods together with their interactions – to design applications and computer programs. Programming techniques may include features such as data abstraction,...
code as well as user-defined functions and user-defined data types to COBOL's repertoire.
Compatibility issues after standardization
COBOL 85 was not fully compatible with earlier versions, resulting in the "cesarean birth" of COBOL 85. Joseph T. Brophy, CIOChief information officer
Chief information officer , or information technology director, is a job title commonly given to the most senior executive in an enterprise responsible for the information technology and computer systems that support enterprise goals...
, Travelers Insurance
St. Paul Travelers
The Travelers Companies is the largest American insurance company by market value. It is also the second largest writer of U.S. commercial property casualty and the third largest writer of U.S. personal insurance through independent agents. Travelers has headquarters in St. Paul, Minnesota and...
, 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
American National Standards Institute
The American National Standards Institute is a private non-profit organization that oversees the development of voluntary consensus standards for products, services, processes, systems, and personnel in the United States. The organization also coordinates U.S. standards with international...
received more than 3,200 letters from the public, mostly negative, requiring the committee to make changes. On the other hand, conversion to COBOL 85 was thought to increase productivity in future years, thus justifying the conversion costs.
Verbose syntax
COBOL syntax has often been criticized for its verbosity. However, proponents note that this was intentional in the language design, and many consider it one of COBOL's strengths. One of the design goals of COBOL was that non-programmers—managers, supervisors, and users—could read and understand the code. This is why COBOL has an English-like syntax and structural elements—including: nouns, verbs, clauses, sentences, sections, and divisions. Consequently, COBOL is considered by at least one source to be "The most readable, understandable and self-documenting programming language in use today. [...] Not only does this readability generally assist the maintenance process but the older a program gets the more valuable this readability becomes." On the other hand, the mere ability to read and understand a few lines of COBOL code does not grant to an executive or end user the experience and knowledge needed to design, build, and maintain large software systems.Other defenses
Additionally, traditional COBOL is a simple language with a limited scope of function (with no pointers, no user-defined types, and no user-defined functions), encouraging a straightforward coding style. This has made it well-suited to its primary domain of business computing—where the program complexity lies in the business rules that need to be encoded rather than sophisticated algorithms or data structures. And because the standard does not belong to any particular vendor, programs written in COBOL are highly portable. The language can be used on a wide variety of hardware platforms and operating systems. And the rigid hierarchical structure restricts the definition of external references to the Environment Division, which simplifies platform changes.See also
- Programming language genealogies
- Alphabetical list of programming languagesAlphabetical list of programming languagesThe aim of this list of programming languages is to include all notable programming languages in existence, both those in current use and historical ones, in alphabetical order, except for dialects of BASIC and esoteric programming languages.- A :...
- Comparison of programming languagesComparison of programming languagesProgramming languages are used for controlling the behavior of a machine . Like natural languages, programming languages conform to rules for syntax and semantics.There are thousands of programming languages and new ones are created every year...
- OpenCOBOLOpenCOBOLOpenCOBOL, is a freely available open source implementation of the COBOL programming language. Originally designed by Keisuke Nishida, the lead developer is now Roger While.-History:...
- CODASYLCODASYLCODASYL is an acronym for "Conference on Data Systems Languages". This was a consortium formed in 1959 to guide the development of a standard programming language that could be used on many computers...
SourcesAlphabetical list of programming languages
The aim of this list of programming languages is to include all notable programming languages in existence, both those in current use and historical ones, in alphabetical order, except for dialects of BASIC and esoteric programming languages.- A :...
Comparison of programming languages
Programming languages are used for controlling the behavior of a machine . Like natural languages, programming languages conform to rules for syntax and semantics.There are thousands of programming languages and new ones are created every year...
OpenCOBOL
OpenCOBOL, is a freely available open source implementation of the COBOL programming language. Originally designed by Keisuke Nishida, the lead developer is now Roger While.-History:...
CODASYL
CODASYL is an acronym for "Conference on Data Systems Languages". This was a consortium formed in 1959 to guide the development of a standard programming language that could be used on many computers...
- Ebbinkhuijsen, Wim B.C., COBOL Alphen aan den Rijn/Diegem: Samson Bedrijfsinformatie bv, 1990. ISBN 90-14-04560-3. (Dutch)
External linksStandards:
Reference manuals:
- IBM Enterprise COBOL for z/OS V4R1 Bookshelf
- IBM VS COBOL II V1R4.0 Bookshelf
- IBM COBOL documentation (iSeries Information Center)
- IBM AIX compiler information center
Compilers and other products:
- IBM COBOL compilers
- Micro Focus Micro Focus Visual COBOL, COBOL development, deployment and modernization.
- Veryant, affordable COBOL maintenance and modernization platform]
- COBOL-IT, The Enterprise-Class Open Source COBOL Compiler]
- OpenCOBOL, an open-source COBOL compiler.
- OpenCOBOL FAQ, and collection of code samples.
- TinyCOBOL, an open-source COBOL compiler based on the COBOL 85 standards