COBOL (; an
acronym
An acronym is a word or name formed from the initial components of a longer name or phrase. Acronyms are usually formed from the initial letters of words, as in ''NATO'' (''North Atlantic Treaty Organization''), but sometimes use syllables, as ...
for "common business-oriented language") is a
compiled
In computing, a compiler is a computer program that translates computer code written in one programming language (the ''source'' language) into another language (the ''target'' language). The name "compiler" is primarily used for programs that ...
English-like
computer programming language
A programming language is a system of notation for writing computer programs. Most programming languages are text-based formal languages, but they may also be graphical. They are a kind of computer language.
The description of a programming la ...
designed for business use. It is an
imperative,
procedural and, since 2002,
object-oriented
Object-oriented programming (OOP) is a programming paradigm based on the concept of "objects", which can contain data and code. The data is in the form of fields (often known as attributes or ''properties''), and the code is in the form of pro ...
language. COBOL is primarily used in business, finance, and administrative systems for companies and governments. COBOL is still widely used in applications deployed on
mainframe computer
A mainframe computer, informally called a mainframe or big iron, is a computer used primarily by large organizations for critical applications like bulk data processing for tasks such as censuses, industry and consumer statistics, enterpris ...
s, such as large-scale
batch
Batch may refer to:
Food and drink
* Batch (alcohol), an alcoholic fruit beverage
* Batch loaf, a type of bread popular in Ireland
* A dialect term for a bread roll used in North Warwickshire, Nuneaton and Coventry, as well as on the Wirra ...
and
transaction processing
Transaction processing is information processing in computer science that is divided into individual, indivisible operations called ''transactions''. Each transaction must succeed or fail as a complete unit; it can never be only partially comple ...
jobs. However, due to its declining popularity and the retirement of experienced COBOL programmers, programs are being migrated to new platforms, rewritten in modern languages or replaced with software packages. Most programming in COBOL is now purely to maintain existing applications; however, many large financial institutions were still developing new systems in COBOL as late as 2006.
COBOL was designed in 1959 by
CODASYL
CODASYL, the Conference/Committee on Data Systems Languages, was a consortium formed in 1959 to guide the development of a standard programming language that could be used on many computers. This effort led to the development of the programming l ...
and was partly based on the programming language
FLOW-MATIC
FLOW-MATIC, originally known as B-0 (Business Language version 0), was the first English-like data processing language. It was developed for the UNIVAC I at Remington Rand under Grace Hopper from 1955 to 1959, and helped shape the development of CO ...
designed by
Grace Hopper
Grace Brewster Hopper (; December 9, 1906 – January 1, 1992) was an American computer scientist, mathematician, and United States Navy Rear admiral (United States), rear admiral. One of the first programmers of the Harvard Mark I, Harvard Mar ...
. It was created as part of a
US Department of Defense
The United States Department of Defense (DoD, USDOD or DOD) is an executive branch department of the federal government charged with coordinating and supervising all agencies and functions of the government directly related to national secu ...
effort to create a
portable
Portable may refer to:
General
* Portable building, a manufactured structure that is built off site and moved in upon completion of site and utility work
* Portable classroom, a temporary building installed on the grounds of a school to provide a ...
programming language for data processing. It was originally seen as a stopgap, but the Department of Defense promptly forced computer manufacturers to provide it, resulting in its widespread adoption. It was
standardized
Standardization or standardisation is the process of implementing and developing technical standards based on the consensus of different parties that include firms, users, interest groups, standards organizations and governments. Standardization ...
in 1968 and has since been revised four times. Expansions include support for
structured
Structuring, also known as smurfing in banking jargon, is the practice of executing financial transactions such as making bank deposits in a specific pattern, calculated to avoid triggering financial institutions to file reports required by law ...
and
object-oriented programming
Object-oriented programming (OOP) is a programming paradigm based on the concept of "objects", which can contain data and code. The data is in the form of fields (often known as attributes or ''properties''), and the code is in the form of pr ...
. The current standard is ''
ISO
ISO is the most common abbreviation for the International Organization for Standardization.
ISO or Iso may also refer to: Business and finance
* Iso (supermarket), a chain of Danish supermarkets incorporated into the SuperBest chain in 2007
* Iso ...
/
IEC
The International Electrotechnical Commission (IEC; in French: ''Commission électrotechnique internationale'') is an international standards organization that prepares and publishes international standards for all electrical, electronic and r ...
1989:2014''.
COBOL statements have an English-like syntax, which was designed to be self-documenting and highly readable. However, it is verbose and uses over 300
reserved word
In a computer language, a reserved word (also known as a reserved identifier) is a word that cannot be used as an identifier, such as the name of a variable, function, or label – it is "reserved from use". This is a syntactic definition, and a re ...
s. In contrast with modern, succinct syntax like , COBOL has a more English-like syntax (in this case, ).
COBOL code is split into four ''divisions'' (identification, environment, data, and procedure) containing a rigid hierarchy of sections, paragraphs and sentences. Lacking a large
standard library
In computer programming, a standard library is the library made available across implementations of a programming language. These libraries are conventionally described in programming language specifications; however, contents of a language's as ...
, the standard specifies 43 statements, 87 functions and just one class.
Academic computer scientists were generally uninterested in business applications when COBOL was created and were not involved in its design; it was (effectively) designed from the ground up as a computer language for business, with an emphasis on inputs and outputs, whose only data types were numbers and strings of text.
COBOL has been
criticized throughout its life for its verbosity, design process, and poor support for
structured programming
Structured programming is a programming paradigm aimed at improving the clarity, quality, and development time of a computer program by making extensive use of the structured control flow constructs of selection ( if/then/else) and repetition ( ...
. These weaknesses result in monolithic, verbose (intended to be English-like) programs that are not easily comprehensible.
For years, COBOL has been assumed as a programming language for business operations in mainframes, although in recent years an increasing interest has surged on migrating COBOL operations to
cloud computing
Cloud computing is the on-demand availability of computer system resources, especially data storage ( cloud storage) and computing power, without direct active management by the user. Large clouds often have functions distributed over mul ...
.
History and specification
Background
In the late 1950s, computer users and manufacturers were becoming concerned about the rising cost of programming. A 1959 survey had found that in any data processing installation, the programming cost US$800,000 on average and that translating programs to run on new hardware would cost $600,000. At a time when new
programming languages were proliferating at an ever-increasing rate, the same survey suggested that if a common business-oriented language were used, conversion would be far cheaper and faster.
On 8 April 1959,
Mary K. Hawes, a computer scientist at
Burroughs Corporation
The Burroughs Corporation was a major American manufacturer of business equipment. The company was founded in 1886 as the American Arithmometer Company. In 1986, it merged with Sperry UNIVAC to form Unisys. The company's history paralleled many ...
, called a meeting of representatives from academia, computer users, and manufacturers at the
University of Pennsylvania
The University of Pennsylvania (also known as Penn or UPenn) is a private research university in Philadelphia. It is the fourth-oldest institution of higher education in the United States and is ranked among the highest-regarded universitie ...
to organize a formal meeting on common business languages. Representatives included
Grace Hopper
Grace Brewster Hopper (; December 9, 1906 – January 1, 1992) was an American computer scientist, mathematician, and United States Navy Rear admiral (United States), rear admiral. One of the first programmers of the Harvard Mark I, Harvard Mar ...
(inventor of the English-like data processing language
FLOW-MATIC
FLOW-MATIC, originally known as B-0 (Business Language version 0), was the first English-like data processing language. It was developed for the UNIVAC I at Remington Rand under Grace Hopper from 1955 to 1959, and helped shape the development of CO ...
),
Jean Sammet
Jean may refer to:
People
* Jean (female given name)
* Jean (male given name)
* Jean (surname)
Fictional characters
* Jean Grey, a Marvel Comics character
* Jean Valjean, fictional character in novel ''Les Misérables'' and its adaptations
* Jea ...
and
Saul Gorn
Saul Gorn (10 November 1912 – 22 February 1992) was an American pioneer in computer and information science who was a member of the School of Engineering and Applied Science at the University of Pennsylvania for more than 30 years.
Gorn was hir ...
.
At the April meeting, the group asked the
Department of Defense Department of Defence or Department of Defense may refer to:
Current departments of defence
* Department of Defence (Australia)
* Department of National Defence (Canada)
* Department of Defence (Ireland)
* Department of National Defense (Philipp ...
(DoD) to sponsor an effort to create a common business language. The delegation impressed Charles A. Phillips, director of the Data System Research Staff at the DoD,
who thought that they "thoroughly understood" the DoD's problems. The DoD operated 225 computers, had a further 175 on order and had spent over $200 million on implementing programs to run on them. Portable programs would save time, reduce costs and ease modernization.
Charles Phillips agreed to sponsor the meeting and tasked the delegation with drafting the agenda.
COBOL 60
On 28 and 29 May 1959 (exactly one year after the Zürich
ALGOL 58
ALGOL 58, originally named IAL, is one of the family of ALGOL computer programming languages. It was an early compromise design soon superseded by ALGOL 60. According to John Backus
The Zurich ACM-GAMM Conference had two principal motives in pro ...
meeting), a meeting was held at the Pentagon to discuss the creation of a common programming language for business. It was attended by 41 people and was chaired by Phillips. The Department of Defense was concerned about whether it could run the same data processing programs on different computers.
FORTRAN, the only mainstream language at the time, lacked the features needed to write such programs.
Representatives enthusiastically described a language that could work in a wide variety of environments, from banking and insurance to utilities and inventory control. They agreed unanimously that more people should be able to program and that the new language should not be restricted by the limitations of contemporary technology. A majority agreed that the language should make maximal use of English, be capable of change, be machine-independent and be easy to use, even at the expense of power.
The meeting resulted in the creation of a
steering committee
A committee or commission is a body of one or more persons subordinate to a deliberative assembly. A committee is not itself considered to be a form of assembly. Usually, the assembly sends matters into a committee as a way to explore them more ...
and short, intermediate and long-range committees. The short-range committee was given to September (three months) to produce specifications for an interim language, which would then be improved upon by the other committees. Their official mission, however, was to identify the strengths and weaknesses of existing programming languages and did not explicitly direct them to create a new language.
The deadline was met with disbelief by the short-range committee.
One member,
Betty Holberton
Frances Elizabeth Holberton (March 7, 1917 – December 8, 2001) was an American computer scientist who was one of the six original programmers of the first general-purpose electronic digital computer, ENIAC. The other five ENIAC programmers wer ...
, described the three-month deadline as "gross optimism" and doubted that the language really would be a stopgap.
The steering committee met on 4 June and agreed to name the entire activity as the ''Committee on Data Systems Languages'', or
CODASYL
CODASYL, the Conference/Committee on Data Systems Languages, was a consortium formed in 1959 to guide the development of a standard programming language that could be used on many computers. This effort led to the development of the programming l ...
, and to form an executive committee.
The short-range committee was made up of members representing six computer manufacturers and three government agencies. The six computer manufacturers were
Burroughs Corporation
The Burroughs Corporation was a major American manufacturer of business equipment. The company was founded in 1886 as the American Arithmometer Company. In 1986, it merged with Sperry UNIVAC to form Unisys. The company's history paralleled many ...
,
IBM,
Minneapolis-Honeywell (Honeywell Labs),
RCA
The RCA Corporation was a major American electronics company, which was founded as the Radio Corporation of America in 1919. It was initially a patent trust owned by General Electric (GE), Westinghouse, AT&T Corporation and United Fruit Comp ...
,
Sperry Rand
Sperry Corporation was a major American equipment and electronics company whose existence spanned more than seven decades of the 20th century. Sperry ceased to exist in 1986 following a prolonged hostile takeover bid engineered by Burroughs ...
, and
Sylvania Electric Products
Sylvania Electric Products Inc. was an American manufacturer of diverse electrical equipment, including at various times radio transceivers, vacuum tubes, semiconductors, and mainframe computers such as MOBIDIC. They were one of the companies in ...
. The three government agencies were the
US Air Force
The United States Air Force (USAF) is the air service branch of the United States Armed Forces, and is one of the eight uniformed services of the United States. Originally created on 1 August 1907, as a part of the United States Army Signal ...
, the Navy's
David Taylor Model Basin
The David Taylor Model Basin (DTMB) is one of the largest ship model basins—test facilities for the development of ship design—in the world. DTMB is a field activity of the Carderock Division of the Naval Surface Warfare Center.
Hist ...
, and the
National Bureau of Standards
The National Institute of Standards and Technology (NIST) is an agency of the United States Department of Commerce whose mission is to promote American innovation and industrial competitiveness. NIST's activities are organized into physical sci ...
(now the National Institute of Standards and Technology). The committee was chaired by
Joseph Wegstein of the US National Bureau of Standards. Work began by investigating data description, statements, existing applications and user experiences.
The committee mainly examined the
FLOW-MATIC
FLOW-MATIC, originally known as B-0 (Business Language version 0), was the first English-like data processing language. It was developed for the UNIVAC I at Remington Rand under Grace Hopper from 1955 to 1959, and helped shape the development of CO ...
,
AIMACO
AIMACO is an acronym for AIr MAterial COmpiler. It began around 1959 as the definition of a high level programming language influenced by the FLOW-MATIC language, developed by UNIVAC, and the COMTRAN (COMmercial TRANslator) programming language, ...
and
COMTRAN
COMTRAN (COMmercial TRANslator) is an early programming language developed at IBM. It was intended as the business programming equivalent of the scientific programming language FORTRAN (FORmula TRANslator). It served as one of the forerunners ...
programming languages.
The FLOW-MATIC language was particularly influential because it had been implemented and because AIMACO was a derivative of it with only minor changes.
FLOW-MATIC's inventor, Grace Hopper, also served as a technical adviser to the committee. FLOW-MATIC's major contributions to COBOL were long variable names, English words for commands and the separation of data descriptions and instructions.
Hopper is sometimes referred to as "the mother of COBOL" or "the grandmother of COBOL", although
Jean Sammet
Jean may refer to:
People
* Jean (female given name)
* Jean (male given name)
* Jean (surname)
Fictional characters
* Jean Grey, a Marvel Comics character
* Jean Valjean, fictional character in novel ''Les Misérables'' and its adaptations
* Jea ...
, a lead designer of COBOL, stated that Hopper "was not the mother, creator or developer of Cobol".
IBM's COMTRAN language, invented by
Bob Bemer
Robert William Bemer (February 8, 1920 – June 22, 2004) was a computer scientist best known for his work at IBM during the late 1950s and early 1960s.
Early life and education
Born in Sault Ste. Marie, Michigan, Bemer graduated from Cranb ...
, was regarded as a competitor to FLOW-MATIC by a short-range committee made up of colleagues of Grace Hopper.
Some of its features were not incorporated into COBOL so that it would not look like IBM had dominated the design process, and Jean Sammet said in 1981 that there had been a "strong anti-IBM bias" from some committee members (herself included).
In one case, after Roy Goldfinger, author of the COMTRAN manual and intermediate-range committee member, attended a subcommittee meeting to support his language and encourage the use of algebraic expressions, Grace Hopper sent a memo to the short-range committee reiterating Sperry Rand's efforts to create a language based on English.
In 1980, Grace Hopper commented that "COBOL 60 is 95% FLOW-MATIC" and that COMTRAN had had an "extremely small" influence. Furthermore, she said that she would claim that work was influenced by both FLOW-MATIC and COMTRAN only to "keep other people happy
o theywouldn't try to knock us out".
Features from COMTRAN incorporated into COBOL included formulas, the
clause, an improved
IF
statement, which obviated the need for
GO TO
GoTo (goto, GOTO, GO TO or other case combinations, depending on the programming language) is a statement found in many computer programming languages. It performs a one-way transfer of control to another line of code; in contrast a function c ...
s, and a more robust file management system.
The usefulness of the committee's work was subject of great debate. While some members thought the language had too many compromises and was the result of
design by committee
Design by committee is a pejorative term for a project that has many designers involved but no unifying plan or vision.
Usage of the term
The term is used to refer to suboptimal traits that such a process may produce as a result of having to compr ...
, others felt it was better than the three languages examined. Some felt the language was too complex; others, too simple.
Controversial features included those some considered useless or too advanced for data processing users. Such features included
boolean expression
In computer science, a Boolean expression is an expression used in programming languages that produces a Boolean value when evaluated. A Boolean value is either true or false. A Boolean expression may be composed of a combination of the Boolean con ...
s,
formula
In science, a formula is a concise way of expressing information symbolically, as in a mathematical formula or a ''chemical formula''. The informal use of the term ''formula'' in science refers to the general construct of a relationship betwee ...
s and table ' (indices). Another point of controversy was whether to make keywords context-sensitive and the effect that would have on readability. Although context-sensitive keywords were rejected, the approach was later used in
PL/I
PL/I (Programming Language One, pronounced and sometimes written PL/1) is a procedural, imperative computer programming language developed and published by IBM. It is designed for scientific, engineering, business and system programming. I ...
and partially in COBOL from 2002. Little consideration was given to
interactivity
Across the many fields concerned with interactivity, including information science, computer science, human-computer interaction, communication, and industrial design, there is little agreement over the meaning of the term "interactivity", but m ...
, interaction with
operating system
An operating system (OS) is system software that manages computer hardware, software resources, and provides common services for computer programs.
Time-sharing operating systems schedule tasks for efficient use of the system and may also in ...
s (few existed at that time) and functions (thought of as purely mathematical and of no use in data processing).
The specifications were presented to the executive committee on 4 September. They fell short of expectations: Joseph Wegstein noted that "it contains rough spots and requires some additions", and Bob Bemer later described them as a "hodgepodge". The subcommittee was given until December to improve it.
At a mid-September meeting, the committee discussed the new language's name. Suggestions included "BUSY" (Business System), "INFOSYL" (Information System Language) and "COCOSYL" (Common Computer Systems Language). It is unclear who coined the name "COBOL", although Bob Bemer later claimed it had been his suggestion.
In October, the intermediate-range committee received copies of the
FACT
A fact is a datum about one or more aspects of a circumstance, which, if accepted as true and proven true, allows a logical conclusion to be reached on a true–false evaluation. Standard reference works are often used to check facts. Scient ...
language specification created by
Roy Nutt
Roy Nutt (October 20, 1930 – June 14, 1990) was an American businessman and computer pioneer. He was a co-creator of Fortran As corrected June 22, 1990. and co-founded Computer Sciences Corporation.
Fortran
Born in Marlborough, Massachuse ...
. Its features impressed the committee so much that they passed a resolution to base COBOL on it.
This was a blow to the short-range committee, who had made good progress on the specification. Despite being technically superior, FACT had not been created with portability in mind or through manufacturer and user consensus. It also lacked a demonstrable implementation, allowing supporters of a FLOW-MATIC-based COBOL to overturn the resolution. RCA representative Howard Bromberg also blocked FACT, so that RCA's work on a COBOL implementation would not go to waste.
It soon became apparent that the committee was too large for any further progress to be made quickly. A frustrated Howard Bromberg bought a $15 tombstone with "COBOL" engraved on it and sent it to Charles Phillips to demonstrate his displeasure.
A sub-committee was formed to analyze existing languages and was made up of six individuals:
* William Selden and Gertrude Tierney of IBM,
* Howard Bromberg and Howard Discount of RCA,
* Vernon Reeves and
Jean E. Sammet
Jean E. Sammet (March 23, 1928 – May 20, 2017) was an American computer scientist who developed the FORMAC programming language in 1962. She was also one of the developers of the influential COBOL programming language.
She received her B.A. i ...
of Sylvania Electric Products.
The sub-committee did most of the work creating the specification, leaving the short-range committee to review and modify their work before producing the finished specification.
The specifications were approved by the executive committee on 8 January 1960, and sent to the government printing office, which printed these as ''COBOL 60''. The language's stated objectives were to allow efficient, portable programs to be easily written, to allow users to move to new systems with minimal effort and cost, and to be suitable for inexperienced programmers.
The CODASYL Executive Committee later created the COBOL Maintenance Committee to answer questions from users and vendors and to improve and expand the specifications.
During 1960, the list of manufacturers planning to build COBOL compilers grew. By September, five more manufacturers had joined CODASYL (
Bendix,
Control Data Corporation
Control Data Corporation (CDC) was a mainframe and supercomputer firm. CDC was one of the nine major United States computer companies through most of the 1960s; the others were IBM, Burroughs Corporation, DEC, NCR, General Electric, Honeywel ...
,
General Electric
General Electric Company (GE) is an American multinational conglomerate founded in 1892, and incorporated in New York state and headquartered in Boston. The company operated in sectors including healthcare, aviation, power, renewable energ ...
(GE),
National Cash Register
NCR Corporation, previously known as National Cash Register, is an American software, consulting and technology company providing several professional services and electronic products. It manufactures self-service kiosks, point-of-sale termin ...
and
Philco
Philco (an acronym for Philadelphia Battery Company) is an American electronics industry, electronics manufacturer headquartered in Philadelphia. Philco was a pioneer in battery, radio, and television production. In 1961, the company was purchased ...
), and all represented manufacturers had announced COBOL compilers. GE and IBM planned to integrate COBOL into their own languages, GECOM and COMTRAN, respectively. In contrast,
International Computers and Tabulators
International Computers and Tabulators or ICT was a British computer manufacturer, formed in 1959 by a merger of the British Tabulating Machine Company (BTM) and Powers-Samas. In 1963 it acquired the business computer divisions of Ferranti. It ...
planned to replace their language, CODEL, with COBOL.
Meanwhile, RCA and Sperry Rand worked on creating COBOL compilers. The first COBOL program ran on 17 August on an RCA 501.
On 6 and 7 December, the same COBOL program (albeit with minor changes) ran on an RCA computer and a Remington-Rand
Univac
UNIVAC (Universal Automatic Computer) was a line of electronic digital stored-program computers starting with the products of the Eckert–Mauchly Computer Corporation. Later the name was applied to a division of the Remington Rand company an ...
computer, demonstrating that compatibility could be achieved.
The relative influences of which languages were used continues to this day in the recommended advisory printed in all COBOL reference manuals:
COBOL-61 to COBOL-65
Many logical flaws were found in ''COBOL 60'', leading General Electric's
Charles Katz
Charles Katz (born in 1927) is an American mathematician and computer scientist known for his contributions to early compiler development in the 1950s.
He received two degrees in mathematics, a Bachelor of Science (B.S.) at Temple University i ...
to warn that it could not be interpreted unambiguously. A reluctant short-term committee enacted a total cleanup and, by March 1963, it was reported that COBOL's syntax was as definable as
ALGOL
ALGOL (; short for "Algorithmic Language") is a family of imperative computer programming languages originally developed in 1958. ALGOL heavily influenced many other languages and was the standard method for algorithm description used by the ...
's, although semantic ambiguities remained.
Early COBOL compilers were primitive and slow. A 1962 US Navy evaluation found compilation speeds of 3–11 statements per minute. By mid-1964, they had increased to 11–1000 statements per minute. It was observed that increasing memory would drastically increase speed and that compilation costs varied wildly: costs per statement were between $0.23 and $18.91.
In late 1962, IBM announced that COBOL would be their primary development language and that development of COMTRAN would cease.
The COBOL specification was revised three times in the five years after its publication.
COBOL-60 was replaced in 1961 by COBOL-61. This was then replaced by the COBOL-61 Extended specifications in 1963, which introduced the sort and report writer facilities.
The added facilities corrected flaws identified by Honeywell in late 1959 in a letter to the short-range committee.
COBOL Edition 1965 brought further clarifications to the specifications and introduced facilities for handling
mass storage
In computing, mass storage refers to the storage of large amounts of data in a persisting and machine-readable fashion. In general, the term is used as large in relation to contemporaneous hard disk drives, but it has been used large in relati ...
files and
tables
Table may refer to:
* Table (furniture), a piece of furniture with a flat surface and one or more legs
* Table (landform), a flat area of land
* Table (information), a data arrangement with rows and columns
* Table (database), how the table data ...
.
COBOL-68
Efforts began to standardize COBOL to overcome incompatibilities between versions. In late 1962, both ISO and the United States of America Standards Institute (now
ANSI
The American National Standards Institute (ANSI ) 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 organi ...
) formed groups to create standards. ANSI produced ''USA Standard COBOL X3.23'' in August 1968, which became the cornerstone for later versions. This version was known as American National Standard (ANS) COBOL and was adopted by ISO in 1972.
COBOL-74
By 1970, COBOL had become the most widely used programming language in the world.
Independently of the ANSI committee, the CODASYL Programming Language Committee was working on improving the language. They described new versions in 1968, 1969, 1970 and 1973, including changes such as new inter-program communication, debugging and file merging facilities as well as improved string-handling and
library
A library is a collection of materials, books or media that are accessible for use and not just for display purposes. A library provides physical (hard copies) or digital access (soft copies) materials, and may be a physical location or a vir ...
inclusion features.
Although CODASYL was independent of the ANSI committee, the ''CODASYL Journal of Development'' was used by ANSI to identify features that were popular enough to warrant implementing.
The Programming Language Committee also liaised with
ECMA and the Japanese COBOL Standard committee.
The Programming Language Committee was not well-known, however. The vice-president, William Rinehuls, complained that two-thirds of the COBOL community did not know of the committee's existence. It was also poor, lacking the funds to make public documents, such as minutes of meetings and change proposals, freely available.
In 1974, ANSI published a revised version of (ANS) COBOL, containing new features such as
file organizations, the statement and the
segmentation module.
Deleted features included the statement, the statement (which was replaced by ) and the implementer-defined random access module (which was superseded by the new sequential and relative I/O modules). These made up 44 changes, which rendered existing statements incompatible with the new standard.
The report writer was slated to be removed from COBOL, but was reinstated before the standard was published. ISO later adopted the updated standard in 1978.
COBOL-85
In June 1978, work began on revising COBOL-74. The proposed standard (commonly called COBOL-80) differed significantly from the previous one, causing concerns about incompatibility and conversion costs. In January 1981, Joseph T. Brophy, Senior Vice-president of Travelers Insurance, threatened to sue the standard committee because it was not
upwards compatible with COBOL-74. Mr. Brophy described previous conversions of their 40-million-line code base as "non-productive" and a "complete waste of our programmer resources".
Later that year, the
Data Processing Management Association
In the pursuit of knowledge, data (; ) is a collection of discrete values that convey information, describing quantity, quality, fact, statistics, other basic units of meaning, or simply sequences of symbols that may be further interpreted ...
(DPMA) said it was "strongly opposed" to the new standard, citing "prohibitive" conversion costs and enhancements that were "forced on the user".
During the first public review period, the committee received 2,200 responses, of which 1,700 were negative form letters.
Other responses were detailed analyses of the effect COBOL-80 would have on their systems; conversion costs were predicted to be at least 50 cents per line of code. Fewer than a dozen of the responses were in favor of the proposed standard.
ISO TC97-SC5 installed in 1979 the international COBOL Experts Group, on initiative of
Wim Ebbinkhuijsen
Wim Ebbinkhuijsen (born 24 December 1939, Amsterdam) is a retired Dutch computer scientist who is considered to be one of the "fathers of COBOL".
in 1979 he initiated the ''International ISO COBOL Working Group''.
From 1967 he was a member, and f ...
. The group consisted of COBOL experts from many countries, including the United States. Its goal was to achieve mutual understanding and respect between ANSI and the rest of the world with regard to the need of new COBOL features. After three years, ISO changed the status of the group to a formal Working Group:
WG 4 COBOL. The group took primary ownership and development of the COBOL standard, where ANSI did most of the proposals.
In 1983, the DPMA withdrew its opposition to the standard, citing the responsiveness of the committee to public concerns. In the same year, a National Bureau of Standards study concluded that the proposed standard would present few problems.
A year later,
DEC released a
VAX/VMS
OpenVMS, often referred to as just VMS, is a multi-user, multiprocessing and virtual memory-based operating system. It is designed to support time-sharing, batch processing, transaction processing and workstation applications. Customers using Ope ...
COBOL-80, who noted that conversion of COBOL-74 programs posed few problems. The new
EVALUATE
statement and inline
PERFORM
were particularly well received and improved productivity, thanks to simplified
control flow
In computer science, control flow (or flow of control) is the order in which individual statements, instructions or function calls of an imperative program are executed or evaluated. The emphasis on explicit control flow distinguishes an ''imper ...
and
debugging
In computer programming and software development, debugging is the process of finding and resolving '' bugs'' (defects or problems that prevent correct operation) within computer programs, software, or systems.
Debugging tactics can involve in ...
.
The second public review drew another 1,000 (mainly negative) responses, while the last drew just 25, by which time many concerns had been addressed.
In 1985, the ISO Working Group 4 accepted the then-version of the ANSI proposed standard, made several changes and set it as the new ISO standard COBOL 85. It was published in late 1985.
Sixty features were changed or deprecated and 115 were added, such as:
* Scope terminators (
END-IF
,
END-PERFORM
,
END-READ
, etc.)
* Nested subprograms
*
CONTINUE
, a
no-operation statement
*
EVALUATE
, a
switch statement
In computer programming languages, a switch statement is a type of selection control mechanism used to allow the value of a variable or expression to change the control flow of program execution via search and map.
Switch statements function some ...
*
INITIALIZE
, a statement that can set groups of data to their default values
* Inline
PERFORM
loop bodies – previously, loop bodies had to be specified in a separate procedure
* Reference modification, which allows access to substrings
* I/O status codes.
The new standard was adopted by all national standard bodies, including ANSI.
Two amendments followed in 1989 and 1993, the first introducing intrinsic functions and the other providing corrections.
COBOL 2002 and object-oriented COBOL
In 1997,
Gartner Group
Gartner, Inc is a technological research and consulting firm based in Stamford, Connecticut that conducts research on technology and shares this research both through private consulting as well as executive programs and conferences. Its clients ...
estimated that there were a total of 200 billion lines of COBOL in existence, which ran 80% of all business programs.
In the early 1990s, work began on adding object-orientation in the next full revision of COBOL. Object-oriented features were taken from
C++
C++ (pronounced "C plus plus") is a high-level general-purpose programming language created by Danish computer scientist Bjarne Stroustrup as an extension of the C programming language, or "C with Classes". The language has expanded significan ...
and
Smalltalk
Smalltalk is an object-oriented, dynamically typed reflective programming language. It was designed and created in part for educational use, specifically for constructionist learning, at the Learning Research Group (LRG) of Xerox PARC by Alan Ka ...
.
The initial estimate was to have this revision completed by 1997, and an ISO Committee Draft (CD) was available by 1997. Some vendors (including
Micro Focus
Micro Focus International plc is a British multinational software and information technology business based in Newbury, Berkshire, England. The firm provides software and consultancy. The company is listed on the London Stock Exchange and is ...
,
Fujitsu
is a Japanese multinational information and communications technology equipment and services corporation, established in 1935 and headquartered in Tokyo. Fujitsu is the world's sixth-largest IT services provider by annual revenue, and the la ...
, and
IBM) introduced object-oriented syntax based on drafts of the full revision. The final approved ISO standard was approved and published in late 2002.
Fujitsu/GTSoftware, Micro Focus and
RainCode introduced object-oriented COBOL compilers targeting the
.NET Framework
The .NET Framework (pronounced as "''dot net"'') is a proprietary software framework developed by Microsoft that runs primarily on Microsoft Windows. It was the predominant implementation of the Common Language Infrastructure (CLI) until bein ...
.
There were many other new features, many of which had been in the ''CODASYL COBOL Journal of Development'' since 1978 and had missed the opportunity to be included in COBOL-85. These other features included:
* Free-form code
*
User-defined function A user-defined function (UDF) is a function provided by the user of a program or environment, in a context where the usual assumption is that functions are built into the program or environment. UDFs are usually written for the requirement of its cr ...
s
*
Recursion
Recursion (adjective: ''recursive'') occurs when a thing is defined in terms of itself or of its type. Recursion is used in a variety of disciplines ranging from linguistics to logic. The most common application of recursion is in mathematics ...
*
Locale-based processing
* Support for extended character sets such as
Unicode
Unicode, formally The Unicode Standard,The formal version reference is is an information technology Technical standard, standard for the consistent character encoding, encoding, representation, and handling of Character (computing), text expre ...
*
Floating-point
In computing, floating-point arithmetic (FP) is arithmetic that represents real numbers approximately, using an integer with a fixed precision, called the significand, scaled by an integer exponent of a fixed base. For example, 12.345 can b ...
and
binary
Binary may refer to:
Science and technology Mathematics
* Binary number, a representation of numbers using only two digits (0 and 1)
* Binary function, a function that takes two arguments
* Binary operation, a mathematical operation that t ...
data types (until then, binary items were truncated based on their declaration's
base-10
The decimal numeral system (also called the base-ten positional numeral system and denary or decanary) is the standard system for denoting integer and non-integer numbers. It is the extension to non-integer numbers of the Hindu–Arabic numeral ...
specification)
* Portable arithmetic results
*
Bit
The bit is the most basic unit of information in computing and digital communications. The name is a portmanteau of binary digit. The bit represents a logical state with one of two possible values. These values are most commonly represente ...
and
boolean data types
*
Pointers
Pointer may refer to:
Places
* Pointer, Kentucky
* Pointers, New Jersey
* Pointers Airport, Wasco County, Oregon, United States
* The Pointers, a pair of rocks off Antarctica
People with the name
* Pointer (surname), a surname (including a l ...
and syntax for getting and freeing storage
* The for
text-based user interface
In computing, text-based user interfaces (TUI) (alternately terminal user interfaces, to reflect a dependence upon the properties of computer terminals and not just text), is a retronym describing a type of user interface (UI) common as an ear ...
s
* The facility
* Improved interoperability with other programming languages and
framework environments such as .NET and
Java
Java (; id, Jawa, ; jv, ꦗꦮ; su, ) is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea to the north. With a population of 151.6 million people, Java is the world's List ...
.
Three
corrigenda
An erratum or corrigendum (plurals: errata, corrigenda) (comes from la, errata corrige) is a correction of a published text. As a general rule, publishers issue an erratum for a production error (i.e., an error introduced during the publishing pro ...
were published for the standard: two in 2006 and one in 2009.
COBOL 2014
Between 2003 and 2009, three technical reports were produced describing
object finalization,
XML
Extensible Markup Language (XML) is a markup language and file format for storing, transmitting, and reconstructing arbitrary data. It defines a set of rules for encoding documents in a format that is both human-readable and machine-readable. T ...
processing and
collection class
In computer science, a container is a class or a data structureEntry ''data structure'' in the Encyclopædia Britannica (2009Online entryAccessed 4 Oct 2011. whose instances are collections of other objects. In other words, they store objects ...
es for COBOL.
COBOL 2002 suffered from poor support: no compilers completely supported the standard. Micro Focus found that it was due to a lack of user demand for the new features and due to the abolition of the
NIST
The National Institute of Standards and Technology (NIST) is an agency of the United States Department of Commerce whose mission is to promote American innovation and industrial competitiveness. NIST's activities are organized into physical sci ...
test suite, which had been used to test compiler conformance. The standardization process was also found to be slow and under-resourced.
COBOL 2014 includes the following changes:
* Portable arithmetic results have been replaced by
IEEE 754
The IEEE Standard for Floating-Point Arithmetic (IEEE 754) is a technical standard for floating-point arithmetic established in 1985 by the Institute of Electrical and Electronics Engineers (IEEE). The standard addressed many problems found i ...
data types
* Major features have been made optional, such as the
VALIDATE
facility, the report writer and the screen-handling facility
* Method overloading
* Dynamic capacity tables (a feature dropped from the draft of COBOL 2002)
Legacy
COBOL programs are used globally in governments and businesses and are running on diverse operating systems such as
z/OS
z/OS is a 64-bit operating system for IBM z/Architecture mainframes, introduced by IBM in October 2000. It derives from and is the successor to OS/390, which in turn was preceded by a string of MVS versions.Starting with the earliest:
* O ...
,
z/VSE
VSEn (''Virtual Storage Extended'') is an operating system for IBM mainframe computers, the latest one in the DOS/360 lineage, which originated in 1965.
DOS/VSE was introduced in 1979 as a successor to DOS/VS; in turn, DOS/VSE was succeeded by ...
,
VME,
Unix
Unix (; trademarked as UNIX) is a family of multitasking, multiuser computer operating systems that derive from the original AT&T Unix, whose development started in 1969 at the Bell Labs research center by Ken Thompson, Dennis Ritchie, and ot ...
,
OpenVMS
OpenVMS, often referred to as just VMS, is a multi-user, multiprocessing and virtual memory-based operating system. It is designed to support time-sharing, batch processing, transaction processing and workstation applications. Customers using Ope ...
and
Windows
Windows is a group of several proprietary graphical operating system families developed and marketed by Microsoft. Each family caters to a certain sector of the computing industry. For example, Windows NT for consumers, Windows Server for serv ...
. In 1997, the
Gartner Group
Gartner, Inc is a technological research and consulting firm based in Stamford, Connecticut that conducts research on technology and shares this research both through private consulting as well as executive programs and conferences. Its clients ...
reported that 80% of the world's business ran on COBOL with over 200 billion lines of code and 5 billion lines more being written annually.
Near the end of the 20th century, the
year 2000 problem
The year 2000 problem, also known as the Y2K problem, Y2K scare, millennium bug, Y2K bug, Y2K glitch, Y2K error, or simply Y2K refers to potential computer errors related to the Time formatting and storage bugs, formatting and storage of cale ...
(Y2K) 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 to correct COBOL code has been attributed to the large amount of business-oriented COBOL, as business applications use dates heavily, and to fixed-length data fields. Some studies attribute as much as "24% of Y2K software repair costs to Cobol". After the clean-up effort put into these programs for Y2K, a 2003 survey found that many remained in use.
The authors said that the survey data suggest "a gradual decline in the importance of COBOL in application development over the
ollowing10 years unless ... integration with other languages and technologies can be adopted".
In 2006 and 2012, ''
Computerworld
''Computerworld'' (abbreviated as CW) is an ongoing decades old professional publication which in 2014 "went digital." Its audience is information technology (IT) and business technology professionals, and is available via a publication website ...
'' surveys (of 352 readers) found that over 60% of organizations used COBOL (more than
C++
C++ (pronounced "C plus plus") is a high-level general-purpose programming language created by Danish computer scientist Bjarne Stroustrup as an extension of the C programming language, or "C with Classes". The language has expanded significan ...
and
Visual Basic .NET
Visual Basic, originally called Visual Basic .NET (VB.NET), is a multi-paradigm, object-oriented programming language, implemented on .NET, Mono, and the .NET Framework. Microsoft launched VB.NET in 2002 as the successor to its original Visua ...
) and that for half of those, COBOL was used for the majority of their internal software.
36% of managers said they planned to migrate from COBOL, and 25% said they would like to if it were cheaper. Instead, some businesses have migrated their systems from expensive mainframes to cheaper, more modern systems, while maintaining their COBOL programs.
Testimony before the
House of Representatives
House of Representatives is the name of legislative bodies in many countries and sub-national entitles. In many countries, the House of Representatives is the lower house of a bicameral legislature, with the corresponding upper house often c ...
in 2016 indicated that COBOL is still in use by many federal agencies.
Reuters
Reuters ( ) is a news agency owned by Thomson Reuters Corporation. It employs around 2,500 journalists and 600 photojournalists in about 200 locations worldwide. Reuters is one of the largest news agencies in the world.
The agency was estab ...
reported in 2017 that 43% of banking systems still used COBOL with over 220 billion lines of COBOL code in use.
By 2019, the number of COBOL programmers was shrinking fast due to retirements, leading to an impending skills gap in business and government organizations which still use mainframe systems for high-volume transaction processing. Efforts to rewrite systems in newer languages have proven expensive and problematic, as has the outsourcing of code maintenance, thus proposals to train more people in COBOL are advocated.
During the
COVID-19 pandemic
The COVID-19 pandemic, also known as the coronavirus pandemic, is an ongoing global pandemic of coronavirus disease 2019 (COVID-19) caused by severe acute respiratory syndrome coronavirus 2 (SARS-CoV-2). The novel virus was first identif ...
and the ensuing surge of unemployment, several US states reported a shortage of skilled COBOL programmers to support the legacy systems used for unemployment benefit management. Many of these systems had been in the process of conversion to more modern programming languages prior to the pandemic, but the process had to be put on hold. Similarly, the US
Internal Revenue Service
The Internal Revenue Service (IRS) is the revenue service for the United States federal government, which is responsible for collecting U.S. federal taxes and administering the Internal Revenue Code, the main body of the federal statutory ta ...
rushed to patch its COBOL-based
Individual Master File
The Individual Master File (IMF) is the system currently used by the United States Internal Revenue Service (IRS) to store and process tax submissions and used as the main data input to process the IRS's transactions. It is a running record of al ...
in order to disburse the tens of millions of payments mandated by the
Coronavirus Aid, Relief, and Economic Security Act
The Coronavirus Aid, Relief, and Economic Security Act, also known as the CARES Act, is a $2.2trillion Stimulus (economics), economic stimulus bill passed by the 116th U.S. Congress and signed into law by President Donald Trump on March 27, 2 ...
.
Features
Syntax
COBOL has an English-like syntax, which is used to describe nearly everything in a program. For example, a condition can be expressed as or more concisely as or . More complex conditions can be "abbreviated" by removing repeated conditions and variables. For example, can be shortened to . To support this English-like syntax, COBOL has over 300
keywords. Some of the keywords are simple alternative or pluralized spellings of the same word, which provides for more English-like statements and clauses; e.g., the and keywords can be used interchangeably, as can and , and and .
Each COBOL program is made up of four basic
lexical items: words, literals, picture character-strings (see ) and separators. Words include reserved words and user-defined identifiers. They are up to 31 characters long and may include letters, digits, hyphens and underscores. Literals include numerals (e.g. ) and strings (e.g. ). Separators include the space character and commas and semi-colons followed by a space.
A COBOL program is split into four divisions: the identification division, the environment division, the data division and the procedure division. The identification division specifies the name and type of the source element and is where classes and interfaces are specified. The environment division specifies any program features that depend on the system running it, such as
files and
character sets
Character encoding is the process of assigning numbers to graphical characters, especially the written characters of human language, allowing them to be stored, transmitted, and transformed using digital computers. The numerical values that ...
. The data division is used to declare
variable
Variable may refer to:
* Variable (computer science), a symbolic name associated with a value and whose associated value may be changed
* Variable (mathematics), a symbol that represents a quantity in a mathematical expression, as used in many ...
s and
parameter
A parameter (), generally, is any characteristic that can help in defining or classifying a particular system (meaning an event, project, object, situation, etc.). That is, a parameter is an element of a system that is useful, or critical, when ...
s. The procedure division contains the program's
statements. Each division is sub-divided into sections, which are made up of paragraphs.
Metalanguage
COBOL's syntax is usually described with a unique
metalanguage
In logic and linguistics, a metalanguage is a language used to describe another language, often called the ''object language''. Expressions in a metalanguage are often distinguished from those in the object language by the use of italics, quot ...
using braces, brackets, bars and underlining. The metalanguage was developed for the original COBOL specifications. Although
Backus–Naur form
In computer science, Backus–Naur form () or Backus normal form (BNF) is a metasyntax notation for context-free grammars, often used to describe the syntax of languages used in computing, such as computer programming languages, document formats ...
did exist at the time, the committee had not heard of it.
As an example, consider the following description of an
ADD
statement:
This description permits the following variants:
ADD 1 TO x
ADD 1, a, b TO x ROUNDED, y, z ROUNDED
ADD a, b TO c
ON SIZE ERROR
DISPLAY "Error"
END-ADD
ADD a TO b
NOT SIZE ERROR
DISPLAY "No error"
ON SIZE ERROR
DISPLAY "Error"
Code format
The height of COBOL's popularity coincided with the era of
keypunch machine
A keypunch is a device for precisely punching holes into stiff paper cards at specific locations as determined by keys struck by a human operator. Other devices included here for that same function include the gang punch, the pantograph punch, ...
s and
punched card
A punched card (also punch card or punched-card) is a piece of stiff paper that holds digital data represented by the presence or absence of holes in predefined positions. Punched cards were once common in data processing applications or to di ...
s. The program itself was written onto punched cards, then read in and compiled, and the data fed into the program was sometimes on cards as well.
COBOL can be written in two formats: fixed (the default) or free. In fixed-format, code must be aligned to fit in certain areas (a hold-over from using punched cards). Until COBOL 2002, these were:
In COBOL 2002, Areas A and B were merged to form the program-text area, which now ends at an implementor-defined column.
COBOL 2002 also introduced free-format code. Free-format code can be placed in any column of the file, as in newer programming languages. Comments are specified using
*>
, which can be placed anywhere and can also be used in fixed-format source code. Continuation lines are not present, and the
>>PAGE
directive replaces the
/
indicator.
Identification division
The identification division identifies the following code entity and contains the definition of a class or interface.
Object-oriented programming
Classes and
interfaces
Interface or interfacing may refer to:
Academic journals
* Interface (journal), ''Interface'' (journal), by the Electrochemical Society
* ''Interface, Journal of Applied Linguistics'', now merged with ''ITL International Journal of Applied Lin ...
have been in COBOL since 2002. Classes have factory objects, containing class
methods
Method ( grc, μέθοδος, methodos) literally means a pursuit of knowledge, investigation, mode of prosecuting such inquiry, or system. In recent centuries it more often means a prescribed process for completing a task. It may refer to:
*Scien ...
and variables, and instance objects, containing instance methods and variables. Inheritance and interfaces provide
polymorphism. Support for
generic programming
Generic programming is a style of computer programming in which algorithms are written in terms of types ''to-be-specified-later'' that are then ''instantiated'' when needed for specific types provided as parameters. This approach, pioneered b ...
is provided through parameterized classes, which can be instantiated to use any class or interface. Objects are stored as references which may be restricted to a certain type. There are two ways of calling a method: the statement, which acts similarly to , or through inline method invocation, which is analogous to using functions.
*> These are equivalent.
INVOKE my-class "foo" RETURNING var
MOVE my-class::"foo" TO var *> Inline method invocation
COBOL does not provide a way to
hide methods. Class data can be hidden, however, by declaring it without a
clause, which leaves the user with no way to access it.
Method overloading
In some programming languages, function overloading or method overloading is the ability to create multiple functions of the same name with different implementations. Calls to an overloaded function will run a specific implementation of that f ...
was added in COBOL 2014.
Environment division
The environment division contains the configuration section and the input-output section. The configuration section is used to specify variable features such
as currency signs, locales and character sets. The input-output section contains file-related information.
Files
COBOL supports three file formats, or ': sequential, indexed and relative. In sequential files, records are contiguous and must be traversed
sequentially
In mathematics, a sequence is an enumerated collection of objects in which repetitions are allowed and order matters. Like a set, it contains members (also called ''elements'', or ''terms''). The number of elements (possibly infinite) is called t ...
, similarly to a
linked list
In computer science, a linked list is a linear collection of data elements whose order is not given by their physical placement in memory. Instead, each element points to the next. It is a data structure consisting of a collection of nodes whic ...
. Indexed files have one or more indexes which allow records to be
randomly accessed and which can be sorted on them. Each record must have a
unique key In relational database management systems, a unique key is a candidate key that is not the primary key of the relation. All the candidate keys of a relation can uniquely identify the records of the relation, but only one of them is used as the prima ...
, but other, ', record keys need not be unique. Implementations of indexed files vary between vendors, although common implementations, such as
C-ISAM and
VSAM Virtual Storage Access Method (VSAM) is an IBM DASD file storage access method, first used in the OS/VS1, OS/VS2 Release 1 (SVS) and Release 2 (MVS) operating systems, later used throughout the Multiple Virtual Storage (MVS) architecture and no ...
, are based on IBM's
ISAM
ISAM (an acronym for indexed sequential access method) is a method for creating, maintaining, and manipulating computer files of data so that records can be retrieved sequentially or randomly by one or more keys. Indexes of key fields are mainta ...
. Relative files, like indexed files, have a unique record key, but they do not have alternate keys. A relative record's key is its ordinal position; for example, the 10th record has a key of 10. This means that creating a record with a key of 5 may require the creation of (empty) preceding records. Relative files also allow for both sequential and random access.
A common non-standard extension is the ' organization, used to process text files. Records in a file are terminated by a
newline
Newline (frequently called line ending, end of line (EOL), next line (NEL) or line break) is a control character or sequence of control characters in character encoding specifications such as ASCII, EBCDIC, Unicode, etc. This character, or a ...
and may be of varying length.
Data division
The data division is split into six sections which declare different items: the file section, for file records; the working-storage section, for
static variable
In computer programming, a static variable is a variable that has been allocated "statically", meaning that its lifetime (or "extent") is the entire run of the program. This is in contrast to shorter-lived automatic variables, whose storage is ...
s; the local-storage section, for
automatic variable
__NOTOC__
In computer programming, an automatic variable is a local variable which is allocated and deallocated automatically when program flow enters and leaves the variable's scope. The scope is the lexical context, particularly the function or b ...
s; the linkage section, for parameters and the return value; the report section and the screen section, for
text-based user interface
In computing, text-based user interfaces (TUI) (alternately terminal user interfaces, to reflect a dependence upon the properties of computer terminals and not just text), is a retronym describing a type of user interface (UI) common as an ear ...
s.
Aggregated data
Data items in COBOL are declared hierarchically through the use of level-numbers which indicate if a data item is part of another. An item with a higher level-number is subordinate to an item with a lower one. Top-level data items, with a level-number of 1, are called '. Items that have subordinate aggregate data are called '; those that do not are called '. Level-numbers used to describe standard data items are between 1 and 49.
01 some-record. *> Aggregate group record item
05 num PIC 9(10). *> Elementary item
05 the-date. *> Aggregate (sub)group record item
10 the-year PIC 9(4). *> Elementary item
10 the-month PIC 99. *> Elementary item
10 the-day PIC 99. *> Elementary item
In the above example, elementary item and group item are subordinate to the record , while elementary items , , and are part of the group item .
Subordinate items can be disambiguated with the (or ) keyword. For example, consider the example code above along with the following example:
01 sale-date.
05 the-year PIC 9(4).
05 the-month PIC 99.
05 the-day PIC 99.
The names , , and are ambiguous by themselves, since more than one data item is defined with those names. To specify a particular data item, for instance one of the items contained within the group, the programmer would use (or the equivalent ). (This syntax is similar to the "dot notation" supported by most contemporary languages.)
Other data levels
A level-number of 66 is used to declare a re-grouping of previously defined items, irrespective of how those items are structured. This data level, also referred to by the associated , is rarely used and, circa 1988, was usually found in old programs. Its ability to ignore the hierarchical and logical structure data meant its use was not recommended and many installations forbade its use.
01 customer-record.
05 cust-key PIC X(10).
05 cust-name.
10 cust-first-name PIC X(30).
10 cust-last-name PIC X(30).
05 cust-dob PIC 9(8).
05 cust-balance PIC 9(7)V99.
66 cust-personal-details RENAMES cust-name THRU cust-dob.
66 cust-all-details RENAMES cust-name THRU cust-balance.
A 77 level-number indicates the item is stand-alone, and in such situations is equivalent to the level-number 01. For example, the following code declares two 77-level data items, and , which are non-group data items that are independent of (not subordinate to) any other data items:
77 property-name PIC X(80).
77 sales-region PIC 9(5).
An 88 level-number declares a ' (a so-called 88-level) which is true when its parent data item contains one of the values specified in its clause. For example, the following code defines two 88-level condition-name items that are true or false depending on the current character data value of the data item. When the data item contains a value of , the condition-name is true, whereas when it contains a value of or , the condition-name is true. If the data item contains some other value, both of the condition-names are false.
01 wage-type PIC X.
88 wage-is-hourly VALUE "H".
88 wage-is-yearly VALUE "S", "Y".
Data types
Standard COBOL provides the following data types:
Type safety is variable in COBOL. Numeric data is converted between different representations and sizes silently and alphanumeric data can be placed in any data item that can be stored as a string, including numeric and group data. In contrast, object references and pointers may only be assigned from items of the same type and their values may be restricted to a certain type.
=PICTURE clause
=
A (or ) clause is a string of characters, each of which represents a portion of the data item and what it may contain. Some picture characters specify the type of the item and how many characters or digits it occupies in memory. For example, a indicates a decimal digit, and an indicates that the item is
signed. Other picture characters (called ' and ' characters) specify how an item should be formatted. For example, a series of characters define character positions as well as how a leading sign character is to be positioned within the final character data; the rightmost non-numeric character will contain the item's sign, while other character positions corresponding to a to the left of this position will contain a space. Repeated characters can be specified more concisely by specifying a number in parentheses after a picture character; for example, is equivalent to . Picture specifications containing only digit () and sign () characters define purely ' data items, while picture specifications containing alphabetic () or alphanumeric () characters define ' data items. The presence of other formatting characters define ' or ' data items.
=USAGE clause
=
The clause declares the format data is stored in. Depending on the data type, it can either complement or be used instead of a clause. While it can be used to declare pointers and object references, it is mostly geared towards specifying numeric types. These numeric formats are:
* Binary, where a minimum size is either specified by the
PICTURE
clause or by a
USAGE
clause such as
BINARY-LONG
.
* , where data may be stored in whatever format the implementation provides; often equivalent to
* , the default format, where data is stored as a string
* Floating-point, in either an implementation-dependent format or according to IEEE 754.
* , where data is stored as a string using an extended character set
* , where data is stored in the smallest possible decimal format (typically
packed binary-coded decimal)
Report writer
The report writer is a
declarative facility for creating reports. The programmer need only specify the report layout and the data required to produce it, freeing them from having to write code to handle things like page breaks, data formatting, and headings and footings.
Reports are associated with report files, which are files which may only be written to through report writer statements.
FD report-out REPORT sales-report.
Each report is defined in the report section of the data division. A report is split into report groups which define the report's headings, footings and details. Reports work around hierarchical '. Control breaks occur when a key variable changes it value; for example, when creating a report detailing customers' orders, a control break could occur when the program reaches a different customer's orders. Here is an example report description for a report which gives a salesperson's sales and which warns of any invalid records:
RD sales-report
PAGE LIMITS 60 LINES
FIRST DETAIL 3
CONTROLS seller-name.
01 TYPE PAGE HEADING.
03 COL 1 VALUE "Sales Report".
03 COL 74 VALUE "Page".
03 COL 79 PIC Z9 SOURCE PAGE-COUNTER.
01 sales-on-day TYPE DETAIL, LINE + 1.
03 COL 3 VALUE "Sales on".
03 COL 12 PIC 99/99/9999 SOURCE sales-date.
03 COL 21 VALUE "were".
03 COL 26 PIC $$$$9.99 SOURCE sales-amount.
01 invalid-sales TYPE DETAIL, LINE + 1.
03 COL 3 VALUE "INVALID RECORD:".
03 COL 19 PIC X(34) SOURCE sales-record.
01 TYPE CONTROL HEADING seller-name, LINE + 2.
03 COL 1 VALUE "Seller:".
03 COL 9 PIC X(30) SOURCE seller-name.
The above report description describes the following layout:
Sales Report Page 1
Seller: Howard Bromberg
Sales on 10/12/2008 were $1000.00
Sales on 12/12/2008 were $0.00
Sales on 13/12/2008 were $31.47
INVALID RECORD: Howard Bromberg XXXXYY
Seller: Howard Discount
...
Sales Report Page 12
Sales on 08/05/2014 were $543.98
INVALID RECORD: William Selden 12O52014FOOFOO
Sales on 30/05/2014 were $0.00
Four statements control the report writer: , which prepares the report writer for printing; , which prints a report group; , which suppresses the printing of a report group; and , which terminates report processing. For the above sales report example, the procedure division might look like this:
OPEN INPUT sales, OUTPUT report-out
INITIATE sales-report
PERFORM UNTIL 1 <> 1
READ sales
AT END
EXIT PERFORM
END-READ
VALIDATE sales-record
IF valid-record
GENERATE sales-on-day
ELSE
GENERATE invalid-sales
END-IF
END-PERFORM
TERMINATE sales-report
CLOSE sales, report-out
.
Use of the Report Writer facility tended to vary considerably; some organizations used it extensively and some not at all. In addition, implementations of Report Writer ranged in quality, with those at the lower end sometimes using excessive amounts of memory at runtime.
Procedure division
Procedures
The sections and paragraphs in the procedure division (collectively called procedures) can be used as
labels
A label (as distinct from signage) is a piece of paper, plastic film, cloth, metal, or other material affixed to a container or product, on which is written or printed information or symbols about the product or item. Information printed dir ...
and as simple
subroutines
In computer programming, a function or subroutine is a sequence of program instructions that performs a specific task, packaged as a unit. This unit can then be used in programs wherever that particular task should be performed.
Functions may ...
. Unlike in other divisions, paragraphs do not need to be in sections.
Execution goes down through the procedures of a program until it is terminated.
To use procedures as subroutines, the verb is used.
A statement somewhat resembles a procedure call in a modern language in the sense that execution returns to the code following the statement at the end of the called code; however, it does not provide any mechanism for
parameter passing or for returning a result value. If a subroutine is invoked using a simple statement like , then control returns at the end of the called procedure. However, is unusual in that it may be used to call a range spanning a sequence of several adjacent procedures. This is done with the construct:
PROCEDURE so-and-so.
PERFORM ALPHA
PERFORM ALPHA THRU GAMMA
STOP RUN.
ALPHA.
DISPLAY 'A'.
BETA.
DISPLAY 'B'.
GAMMA.
DISPLAY 'C'.
The output of this program will be: "A A B C".
also differs from conventional procedure calls in that there is, at least traditionally, no notion of a call stack. As a consequence, nested invocations are possible (a sequence of code being 'ed may execute a statement itself), but require extra care if parts of the same code are executed by both invocations. The problem arises when the code in the inner invocation reaches the exit point of the outer invocation. More formally, if control passes through the exit point of a invocation that was called earlier but has not completed yet, the COBOL 2002 standard officially stipulates that the behavior is
undefined
Undefined may refer to:
Mathematics
* Undefined (mathematics), with several related meanings
** Indeterminate form, in calculus
Computing
* Undefined behavior, computer code whose behavior is not specified under certain conditions
* Undefined ...
.
The reason is that COBOL, rather than a "return address", operates with what may be called a continuation address. When control flow reaches the end of any procedure, the continuation address is looked up and control is transferred to that address. Before the program runs, the continuation address for every procedure is initialized to the start address of the procedure that comes next in the program text so that, if no statements happen, control flows from top to bottom through the program. But when a statement executes, it modifies the continuation address of the called procedure (or the last procedure of the called range, if was used), so that control will return to the call site at the end. The original value is saved and is restored afterwards, but there is only one storage position. If two nested invocations operate on overlapping code, they may interfere which each other's management of the continuation address in several ways.
The following example (taken from ) illustrates the problem:
LABEL1.
DISPLAY '1'
PERFORM LABEL2 THRU LABEL3
STOP RUN.
LABEL2.
DISPLAY '2'
PERFORM LABEL3 THRU LABEL4.
LABEL3.
DISPLAY '3'.
LABEL4.
DISPLAY '4'.
One might expect that the output of this program would be "1 2 3 4 3": After displaying "2", the second causes "3" and "4" to be displayed, and then the first invocation continues on with "3". In traditional COBOL implementations, this is not the case. Rather, the first statement sets the continuation address at the end of so that it will jump back to the call site inside . The second statement sets the return at the end of but does not modify the continuation address of , expecting it to be the default continuation. Thus, when the inner invocation arrives at the end of , it jumps back to the outer statement, and the program stops having printed just "1 2 3". On the other hand, in some COBOL implementations like the open-source TinyCOBOL compiler, the two statements do not interfere with each other and the output is indeed "1 2 3 4 3". Therefore, the behavior in such cases is not only (perhaps) surprising, it is also not portable.
A special consequence of this limitation is that cannot be used to write recursive code. Another simple example to illustrate this (slightly simplified from ):
MOVE 1 TO A
PERFORM LABEL
STOP RUN.
LABEL.
DISPLAY A
IF A < 3
ADD 1 TO A
PERFORM LABEL
END-IF
DISPLAY 'END'.
One might expect that the output is "1 2 3 END END END", and in fact that is what some COBOL compilers will produce. But some compilers, like IBM COBOL, will produce code that prints "1 2 3 END END END END ..." and so on, printing "END" over and over in an endless loop. Since there is limited space to store backup continuation addresses, the backups get overwritten in the course of recursive invocations, and all that can be restored is the jump back to .
Statements
COBOL 2014 has 47 statements (also called '), which can be grouped into the following broad categories: control flow, I/O, data manipulation and the report writer. The report writer statements are covered in the
report writer section.
=Control flow
=
COBOL's
conditional statements are and . is a
switch-like statement with the added capability of evaluating multiple values and conditions. This can be used to implement
decision table
Decision tables are a concise visual representation for specifying which actions to perform depending on given conditions. They are algorithms whose output is a set of actions. The information expressed in decision tables could also be represented ...
s. For example, the following might be used to control a
CNC lathe
Numerical control (also computer numerical control, and commonly called CNC) is the automated control of machining tools (such as drills, lathes, mills, grinders, routers and 3D printers) by means of a computer. A CNC machine processes a ...
:
EVALUATE TRUE ALSO desired-speed ALSO current-speed
WHEN lid-closed ALSO min-speed THRU max-speed ALSO LESS THAN desired-speed
PERFORM speed-up-machine
WHEN lid-closed ALSO min-speed THRU max-speed ALSO GREATER THAN desired-speed
PERFORM slow-down-machine
WHEN lid-open ALSO ANY ALSO NOT ZERO
PERFORM emergency-stop
WHEN OTHER
CONTINUE
END-EVALUATE
The statement is used to define loops which are executed a condition is true (not true, which is more common in other languages). It is also used to call procedures or ranges of procedures (see the
procedures section for more details). and call subprograms and methods, respectively. The name of the subprogram/method is contained in a string which may be a literal or a data item. Parameters can be passed
by reference, by content (where a copy is passed by reference) or
by value (but only if a
prototype
A prototype is an early sample, model, or release of a product built to test a concept or process. It is a term used in a variety of contexts, including semantics, design, electronics, and Software prototyping, software programming. A prototyp ...
is available).
unloads subprograms from memory. causes the program to jump to a specified procedure.
The statement is a
return statement
In computer programming, a return statement causes execution to leave the current subroutine and resume at the point in the code immediately after the instruction which called the subroutine, known as its return address. The return address is sav ...
and the statement stops the program. The statement has six different formats: it can be used as a return statement, a
break statement
In computer science, control flow (or flow of control) is the order in which individual statements, instructions or function calls of an imperative program are executed or evaluated. The emphasis on explicit control flow distinguishes an ''imper ...
, a
continue statement, an end marker or to leave a procedure.
Exceptions are raised by a statement and caught with a handler, or ', defined in the portion of the procedure division. Declaratives are sections beginning with a statement which specify the errors to handle. Exceptions can be names or objects. is used in a declarative to jump to the statement after the one that raised the exception or to a procedure outside the . Unlike other languages, uncaught exceptions may not terminate the program and the program can proceed unaffected.
=I/O
=
File I/O is handled by the self-describing , , , and statements along with a further three: , which updates a record; , which selects subsequent records to access by finding a record with a certain key; and , which releases a
lock
Lock(s) may refer to:
Common meanings
*Lock and key, a mechanical device used to secure items of importance
*Lock (water navigation), a device for boats to transit between different levels of water, as in a canal
Arts and entertainment
* ''Lock ...
on the last record accessed.
User interaction is done using and .
=Data manipulation
=
The following verbs manipulate data:
* , which sets data items to their default values.
* , which
assigns
An assignment is a legal term used in the context of the law of contract and of property. In both instances, assignment is the process e
whereby a person, the ''assignor'', transfers rights or benefits to another, the ''assignee''.For the assig ...
values to data items ; ''MOVE CORRESPONDING'' assigns corresponding like-named
fields
Fields may refer to:
Music
*Fields (band), an indie rock band formed in 2006
*Fields (progressive rock band), a progressive rock band formed in 1971
* ''Fields'' (album), an LP by Swedish-based indie rock band Junip (2010)
* "Fields", a song by ...
.
* , which has 15 formats: it can modify indices, assign object references and alter table capacities, among other functions.
* , , , , and , which handle arithmetic (with assigning the result of a formula to a variable).
* and , which handle
dynamic memory
Memory management is a form of resource management applied to computer memory. The essential requirement of memory management is to provide ways to dynamically allocate portions of memory to programs at their request, and free it for reuse when ...
.
* , which validates and distributes data as specified in an item's description in the data division.
* and , which
concatenate
In formal language theory and computer programming, string concatenation is the operation of joining character strings end-to-end. For example, the concatenation of "snow" and "ball" is "snowball". In certain formalisations of concatenat ...
and split
strings, respectively.
* , which tallies or replaces instances of specified
substring
In formal language theory and computer science, a substring is a contiguous sequence of characters within a string. For instance, "''the best of''" is a substring of "''It was the best of times''". In contrast, "''Itwastimes''" is a subsequence ...
s within a string.
* , which searches a table for the first entry satisfying a condition.
Files and tables are sorted using and the verb merges and sorts files. The verb provides records to sort and retrieves sorted records in order.
Scope termination
Some statements, such as and , may themselves contain statements. Such statements may be terminated in two ways: by a period ('), which terminates ''all'' unterminated statements contained, or by a scope terminator, which terminates the nearest matching open statement.
*> Terminator period ("implicit termination")
IF invalid-record
IF no-more-records
NEXT SENTENCE
ELSE
READ record-file
AT END SET no-more-records TO TRUE.
*> Scope terminators ("explicit termination")
IF invalid-record
IF no-more-records
CONTINUE
ELSE
READ record-file
AT END SET no-more-records TO TRUE
END-READ
END-IF
END-IF
Nested statements terminated with a period are a common source of bugs. For example, examine the following code:
IF x
DISPLAY y.
DISPLAY z.
Here, the intent is to display
y
and
z
if condition
x
is true. However,
z
will be displayed whatever the value of
x
because the
IF
statement is terminated by an erroneous period after .
Another bug is a result of the
dangling else problem, when two
IF
statements can associate with an
ELSE
.
IF x
IF y
DISPLAY a
ELSE
DISPLAY b.
In the above fragment, the
ELSE
associates with the statement instead of the statement, causing a bug. Prior to the introduction of explicit scope terminators, preventing it would require to be placed after the inner
IF
.
Self-modifying code
The original (1959) COBOL specification supported the infamous statement, for which many compilers generated
self-modifying code
In computer science, self-modifying code (SMC) 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, ...
.
X
and
Y
are procedure labels, and the single statement in procedure
X
executed after such an statement means instead. Many compilers still support it,
but it was deemed
obsolete
Obsolescence is the state of being which occurs when an object, service, or practice is no longer maintained or required even though it may still be in good working order. It usually happens when something that is more efficient or less risky r ...
in the COBOL 1985 standard and deleted in 2002.
The statement was poorly regarded because it undermined "locality of context" and made a program's overall logic difficult to comprehend. As textbook author
Daniel D. McCracken wrote in 1976, when "someone who has never seen the program before must become familiar with it as quickly as possible, sometimes under critical time pressure because the program has failed ... the sight of a GO TO statement in a paragraph by itself, signaling as it does the existence of an unknown number of ALTER statements at unknown locations throughout the program, strikes fear in the heart of the bravest programmer."
Hello, world
A "
Hello, world" program in COBOL:
IDENTIFICATION DIVISION.
PROGRAM-ID. hello-world.
PROCEDURE DIVISION.
DISPLAY "Hello, world!"
.
When the – now famous –
"Hello, World!" program
A "Hello, World!" program is generally a computer program that ignores any input and outputs or displays a message similar to "Hello, World!". A small piece of code in most general-purpose programming languages, this program is used to illustra ...
example in ''
The C Programming Language
''The C Programming Language'' (sometimes termed ''K&R'', after its authors' initials) is a computer programming book written by Brian Kernighan and Dennis Ritchie, the latter of whom originally designed and implemented the language, as well as ...
'' was first published in 1978 a similar mainframe COBOL program sample would have been submitted through
JCL, very likely using a punch card reader, and 80 column punch cards. The listing below, ''with an empty DATA DIVISION'', was tested using Linux and the System/370
Hercules emulator
Hercules is a computer emulator allowing software written for IBM mainframe computers (System/370, System/390, and zSeries/System z) and for plug compatible mainframes (such as Amdahl machines) to run on other types of computer hardware, nota ...
running
MVS
Multiple Virtual Storage, more commonly called MVS, was the most commonly used operating system on the System/370 and System/390 IBM mainframe computers. IBM developed MVS, along with OS/VS1 and SVS, as a successor to OS/360. It is unrelated ...
3.8J. The JCL, written in July 2015, is derived from the Hercules tutorials and samples hosted by Jay Moseley. In keeping with COBOL programming of that era, HELLO, WORLD is displayed in all capital letters.
//COBUCLG JOB (001),'COBOL BASE TEST', 00010000
// CLASS=A,MSGCLASS=A,MSGLEVEL=(1,1) 00020000
//BASETEST EXEC COBUCLG 00030000
//COB.SYSIN DD * 00040000
00000* VALIDATION OF BASE COBOL INSTALL 00050000
01000 IDENTIFICATION DIVISION. 00060000
01100 PROGRAM-ID. 'HELLO'. 00070000
02000 ENVIRONMENT DIVISION. 00080000
02100 CONFIGURATION SECTION. 00090000
02110 SOURCE-COMPUTER. GNULINUX. 00100000
02120 OBJECT-COMPUTER. HERCULES. 00110000
02200 SPECIAL-NAMES. 00120000
02210 CONSOLE IS CONSL. 00130000
03000 DATA DIVISION. 00140000
04000 PROCEDURE DIVISION. 00150000
04100 00-MAIN. 00160000
04110 DISPLAY 'HELLO, WORLD' UPON CONSL. 00170000
04900 STOP RUN. 00180000
//LKED.SYSLIB DD DSNAME=SYS1.COBLIB,DISP=SHR 00190000
// DD DSNAME=SYS1.LINKLIB,DISP=SHR 00200000
//GO.SYSPRINT DD SYSOUT=A 00210000
// 00220000
After submitting the JCL, the MVS console displayed:
19.52.48 JOB 3 $HASP100 COBUCLG ON READER1 COBOL BASE TEST
19.52.48 JOB 3 IEF677I WARNING MESSAGE(S) FOR JOB COBUCLG ISSUED
19.52.48 JOB 3 $HASP373 COBUCLG STARTED - INIT 1 - CLASS A - SYS BSP1
19.52.48 JOB 3 IEC130I SYSPUNCH DD STATEMENT MISSING
19.52.48 JOB 3 IEC130I SYSLIB DD STATEMENT MISSING
19.52.48 JOB 3 IEC130I SYSPUNCH DD STATEMENT MISSING
19.52.48 JOB 3 IEFACTRT - Stepname Procstep Program Retcode
19.52.48 JOB 3 COBUCLG BASETEST COB IKFCBL00 RC= 0000
19.52.48 JOB 3 COBUCLG BASETEST LKED IEWL RC= 0000
19.52.48 JOB 3 +HELLO, WORLD
19.52.48 JOB 3 COBUCLG BASETEST GO PGM=*.DD RC= 0000
19.52.48 JOB 3 $HASP395 COBUCLG ENDED
''Line 10 of the console listing above is highlighted for effect, the highlighting is not part of the actual console output''.
The associated compiler listing generated over four pages of technical detail and job run information, for the single line of output from the 14 lines of COBOL.
Reception
Lack of structure
In the 1970s, adoption of the
structured programming
Structured programming is a programming paradigm aimed at improving the clarity, quality, and development time of a computer program by making extensive use of the structured control flow constructs of selection ( if/then/else) and repetition ( ...
paradigm was becoming increasingly widespread.
Edsger Dijkstra
Edsger Wybe Dijkstra ( ; ; 11 May 1930 – 6 August 2002) was a Dutch computer scientist, programmer, software engineer, systems scientist, and science essayist. He received the 1972 Turing Award for fundamental contributions to developing progra ...
, a preeminent computer scientist, wrote a
letter to the editor
A letter to the editor (LTE) is a Letter (message), letter sent to a publication about an issue of concern to the reader. Usually, such letters are intended for publication. In many publications, letters to the editor may be sent either through ...
of
Communications of the ACM
''Communications of the ACM'' is the monthly journal of the Association for Computing Machinery (ACM). It was established in 1958, with Saul Rosen as its first managing editor. It is sent to all ACM members.
Articles are intended for readers with ...
, published 1975 entitled "How do we tell truths that might hurt?", in which he was critical of COBOL and several other contemporary languages; remarking that "the use of COBOL cripples the mind".
In a published dissent to Dijkstra's remarks, the computer scientist Howard E. Tompkins claimed that
unstructured COBOL tended to be "written by programmers that have never had the benefit of structured COBOL taught well", arguing that the issue was primarily one of training.
One cause of
spaghetti code
Spaghetti code is a pejorative phrase for unstructured and difficult-to- maintain source code. Spaghetti code can be caused by several factors, such as volatile project requirements, lack of programming style rules, and software engineers with insu ...
was the statement. Attempts to remove s from COBOL code, however, resulted in convoluted programs and reduced code quality. s were largely replaced by the statement and procedures, which promoted
modular programming
Modular programming is a software design technique that emphasizes separating the functionality of a program into independent, interchangeable modules, such that each contains everything necessary to execute only one aspect of the desired function ...
and gave easy access to powerful looping facilities. However, could be used only with procedures so loop bodies were not located where they were used, making programs harder to understand.
COBOL programs were infamous for being monolithic and lacking modularization.
COBOL code could be modularized only through procedures, which were found to be inadequate for large systems. It was impossible to restrict access to data, meaning a procedure could access and modify data item. Furthermore, there was no way to pass
parameter
A parameter (), generally, is any characteristic that can help in defining or classifying a particular system (meaning an event, project, object, situation, etc.). That is, a parameter is an element of a system that is useful, or critical, when ...
s to a procedure, an omission Jean Sammet regarded as the committee's biggest mistake.
Another complication stemmed from the ability to a specified sequence of procedures. This meant that control could jump to and return from any procedure, creating convoluted control flow and permitting a programmer to break the
single-entry single-exit rule.
This situation improved as COBOL adopted more features. COBOL-74 added subprograms, giving programmers the ability to control the data each part of the program could access. COBOL-85 then added nested subprograms, allowing programmers to hide subprograms. Further control over data and code came in 2002 when object-oriented programming, user-defined functions and user-defined data types were included.
Nevertheless, much important legacy COBOL software uses unstructured code, which has become unmaintainable. It can be too risky and costly to modify even a simple section of code, since it may be used from unknown places in unknown ways.
Compatibility issues
COBOL was intended to be a highly portable, "common" language. However, by 2001, around 300 dialects had been created. One source of dialects was the standard itself: the 1974 standard was composed of one mandatory nucleus and eleven functional modules, each containing two or three levels of support. This permitted 104,976 official variants.
COBOL-85 was not fully compatible with earlier versions, and its development was controversial. Joseph T. Brophy, the
CIO of
Travelers Insurance
The Travelers Companies, Inc., commonly known as Travelers, is an American insurance company. It is the second-largest writer of U.S. commercial property casualty insurance, and the sixth-largest writer of U.S. personal insurance through indepen ...
, spearheaded an effort to inform COBOL users of the heavy reprogramming costs of implementing the new standard. As a result, the ANSI COBOL Committee received more than 2,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. Proponents say that this was intended to make the code
self-documenting
In computer programming, self-documenting (or self-describing) source code and user interfaces follow naming conventions and structured programming conventions that enable use of the system without prior specific knowledge. In web development, se ...
, easing program maintenance. COBOL was also intended to be easy for programmers to learn and use, while still being readable to non-technical staff such as managers.
The desire for readability led to the use of English-like syntax and structural elements, such as nouns, verbs, clauses, sentences, sections, and divisions. Yet by 1984, maintainers of COBOL programs were struggling to deal with "incomprehensible" code and the main changes in COBOL-85 were there to help ease maintenance.
Jean Sammet, a short-range committee member, noted that "little attempt was made to cater to the professional programmer, in fact people whose main interest is programming tend to be very unhappy with COBOL" which she attributed to COBOL's verbose syntax.
Isolation from the computer science community
The COBOL community has always been isolated from the computer science community. No academic computer scientists participated in the design of COBOL: all of those on the committee came from commerce or government. Computer scientists at the time were more interested in fields like numerical analysis, physics and system programming than the commercial file-processing problems which COBOL development tackled. Jean Sammet attributed COBOL's unpopularity to an initial "snob reaction" due to its inelegance, the lack of influential computer scientists participating in the design process and a disdain for business data processing. The COBOL specification used a unique "notation", or
metalanguage
In logic and linguistics, a metalanguage is a language used to describe another language, often called the ''object language''. Expressions in a metalanguage are often distinguished from those in the object language by the use of italics, quot ...
, to define its syntax rather than the new
Backus–Naur form
In computer science, Backus–Naur form () or Backus normal form (BNF) is a metasyntax notation for context-free grammars, often used to describe the syntax of languages used in computing, such as computer programming languages, document formats ...
which the committee did not know of. This resulted in "severe" criticism.
Later, COBOL suffered from a shortage of material covering it; it took until 1963 for introductory books to appear (with Richard D. Irwin publishing a college textbook on COBOL in 1966). By 1985, there were twice as many books on FORTRAN and four times as many on BASIC as on COBOL in the
Library of Congress
The Library of Congress (LOC) is the research library that officially serves the United States Congress and is the ''de facto'' national library of the United States. It is the oldest federal cultural institution in the country. The library is ...
. University professors taught more modern, state-of-the-art languages and techniques instead of COBOL which was said to have a "trade school" nature. Donald Nelson, chair of the CODASYL COBOL committee, said in 1984 that "academics ... hate COBOL" and that computer science graduates "had 'hate COBOL' drilled into them".
By the mid-1980s, there was also significant condescension towards COBOL in the business community from users of other languages, for example
FORTRAN or
assembler
Assembler may refer to:
Arts and media
* Nobukazu Takemura, avant-garde electronic musician, stage name Assembler
* Assemblers, a fictional race in the ''Star Wars'' universe
* Assemblers, an alternative name of the superhero group Champions of A ...
, implying that COBOL could be used only for non-challenging problems.
In 2003, COBOL featured in 80% of
information systems
An information system (IS) is a formal, sociotechnical, organizational system designed to collect, process, information storage, store, and information distribution, distribute information. From a sociotechnical perspective, information systems a ...
curricula in the United States, the same proportion as
C++
C++ (pronounced "C plus plus") is a high-level general-purpose programming language created by Danish computer scientist Bjarne Stroustrup as an extension of the C programming language, or "C with Classes". The language has expanded significan ...
and
Java
Java (; id, Jawa, ; jv, ꦗꦮ; su, ) is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea to the north. With a population of 151.6 million people, Java is the world's List ...
. Ten years later, a poll by
Micro Focus
Micro Focus International plc is a British multinational software and information technology business based in Newbury, Berkshire, England. The firm provides software and consultancy. The company is listed on the London Stock Exchange and is ...
found that 20% of university academics thought COBOL was outdated or dead and that 55% believed their students thought COBOL was outdated or dead. The same poll also found that only 25% of academics had COBOL programming on their curriculum even though 60% thought they should teach it.
Concerns about the design process
Doubts have been raised about the competence of the standards committee. Short-term committee member Howard Bromberg said that there was "little control" over the development process and that it was "plagued by discontinuity of personnel and ... a lack of talent." Jean Sammet and Jerome Garfunkel also noted that changes introduced in one revision of the standard would be reverted in the next, due as much to changes in who was in the standard committee as to objective evidence.
COBOL standards have repeatedly suffered from delays: COBOL-85 arrived five years later than hoped,
COBOL 2002 was five years late,
and COBOL 2014 was six years late.
To combat delays, the standard committee allowed the creation of optional addenda which would add features more quickly than by waiting for the next standard revision. However, some committee members raised concerns about incompatibilities between implementations and frequent modifications of the standard.
Influences on other languages
COBOL's data structures influenced subsequent programming languages. Its record and file structure influenced
PL/I
PL/I (Programming Language One, pronounced and sometimes written PL/1) is a procedural, imperative computer programming language developed and published by IBM. It is designed for scientific, engineering, business and system programming. I ...
and
Pascal
Pascal, Pascal's or PASCAL may refer to:
People and fictional characters
* Pascal (given name), including a list of people with the name
* Pascal (surname), including a list of people and fictional characters with the name
** Blaise Pascal, Fren ...
, and the
REDEFINES
clause was a predecessor to Pascal's variant records. Explicit file structure definitions preceded the development of
database management systems
In computing, a database is an organized collection of data stored and accessed electronically. Small databases can be stored on a file system, while large databases are hosted on computer clusters or cloud storage. The design of databases span ...
and aggregated data was a significant advance over Fortran's arrays.
PICTURE
data declarations were incorporated into PL/I, with minor changes.
COBOL's facility, although considered "primitive", influenced the development of
include directive
Many programming languages and other computer files have a directive, often called include (sometimes copy or import), that causes the contents of the specified file to be inserted into the original file. These included files are called copybooks ...
s.
The focus on portability and standardization meant programs written in COBOL could be portable and facilitated the spread of the language to a wide variety of hardware platforms and operating systems.
[This can be seen in:
*
*
*
] Additionally, the well-defined division structure restricts the definition of external references to the Environment Division, which simplifies platform changes in particular.
See also
*
Alphabetical list of programming languages
*
BLIS/COBOL
*
CODASYL
CODASYL, the Conference/Committee on Data Systems Languages, was a consortium formed in 1959 to guide the development of a standard programming language that could be used on many computers. This effort led to the development of the programming l ...
*
Comparison of programming languages
Programming languages are used for controlling the behavior of a machine (often a computer). Like natural languages, programming languages follow the rules for syntax and semantics.
There are thousands of programming languages and new ones are c ...
*
*
Notes
References
Citations
Sources
*
*
*
*
*
*
*
*
* (Link goes to draft N 0147)
*
*
*
*
*
*
*
*
*
*
*
*
External links
*
COBOL Language Standard(1991; COBOL-85 with Amendment 1), from
The Open Group
The Open Group is a global consortium that seeks to "enable the achievement of business objectives" by developing "open, vendor-neutral technology standards and certifications." It has over 840 member organizations and provides a number of servi ...
{{DEFAULTSORT:Cobol
.NET programming languages
1959 software
Class-based programming languages
Computer-related introductions in 1959
Cross-platform software
Object-oriented programming languages
Procedural programming languages
Programming languages created by women
Programming languages created in 1959
Programming languages with an ISO standard
Statically typed programming languages
Structured programming languages