COBOL#COBOL 2014

{{short description|Programming language with English-like syntax}}

{{Use dmy dates|date=September 2024}}

{{Use American English|date=October 2014}}

{{Infobox programming language

| name = COBOL

| logo = COBOL Report Apr60.djvu

| logo caption = The COBOL 60 report to CODASYL (April 1960)

| paradigm = Procedural, imperative, object-oriented, generic

| year = {{Start date and age|df=yes|1959}}

| designers = {{nowrap|Howard Bromberg}}, {{nowrap|Norman Discount}}, {{nowrap|Vernon Reeves}}, {{nowrap|Jean E. Sammet}}, {{nowrap|William Selden}}, {{nowrap|Gertrude Tierney}}, with indirect influence from {{nowrap|Grace Hopper}}

| developers = CODASYL, ANSI, ISO/IEC

| latest release version = ISO/IEC 1989:2023

| latest release date = 2023

| typing = Weak, static

| implementations = {{nowraplinks|GnuCOBOL, IBM COBOL}}, {{nowrap|Micro Focus Visual COBOL}}

| dialects = COBOL/2, DEC COBOL-10, DEC PDP-11 COBOL, DEC PDP-11 COBOL-85, DEC VAX COBOL, DOSVS COBOL, Envyr ICOBOL, Fujitsu COBOL, Hitachi COBOL2002, HP3000 COBOL/II, IBM COBOL SAA, IBM COBOL/400, IBM COBOL/II, IBM Enterprise COBOL, IBM ILE COBOL, IBM OS/VS COBOL, ICL COBOL (VME), Micro Focus ACUCOBOL-GT, Micro Focus COBOL-IT, Micro Focus RM/COBOL, Micro Focus Visual COBOL, Microsoft COBOL, Raincode COBOL, Realia COBOL, Ryan McFarland RM/COBOL, Ryan McFarland RM/COBOL-85, Tandem (NonStop) COBOL, Tandem (NonStop) SCOBOL, UNIVAC COBOL, Unisys MCP COBOL74, Unisys MCP COBOL85, X/Open COBOL,{{cite book|url=https://pubs.opengroup.org/onlinepubs/009680799/toc.pdf|title=Technical Standard, COBOL Language|publisher=X/Open Company Ltd., U.K.|date=December 1991|isbn=1-872630-09-X}} Veryant isCOBOL, Wang VS COBOL, WATBOL

| influenced by = Initial: AIMACO, COMTRAN, FACT, FLOW-MATIC


COBOL 2002:{{efn|name=2002 influence|Specifically influenced COBOL 2002's object-oriented features.{{cite journal | title=Cobol: Perception and Reality | journal=Computer | date=March 1997 | volume=30 | issue=3 | doi=10.1109/2.573683 | page=127 | issn=0018-9162 | first1=Edmund C. | last1=Arranga | first2=Frank P. | last2=Coyle }}}} C++, Eiffel, Smalltalk

| influenced = CobolScript,{{cite conference | title=COBOL Script: a business-oriented scripting language | first1=Tetsuji | last1=Imajo | first2=Tatsuki | last2=Miyake | first3=Shinobu | last3=Sato | first4=Toshiyuki | last4=Ito | first5=Daisuke | last5=Yokotsuka | first6=Yoshihide | last6=Tsujihata | first7=Shunsuke | last7=Uemura | display-authors=1 | publisher=IEEE | date=September 2000 | conference=Enterprise Distributed Object Computing Conference | conference-url=http://dblp1.uni-trier.de/db/conf/edoc/edoc2000.html | location=Makuhari, Japan | isbn=0769508650 | doi=10.1109/EDOC.2000.882363 }} EGL,{{cite web | url=https://www.omg.org/adm/EGLOverviewtoOMG.pdf | title=Introduction to EGL | publisher=IBM Software Group | date=7 May 2007 | first=Wing Hong | last=Ho | access-date=12 January 2019 | archive-date=13 January 2019 | archive-url=https://web.archive.org/web/20190113063021/https://www.omg.org/adm/EGLOverviewtoOMG.pdf | url-status=dead }} PL/I,{{cite conference | title=The early history and characteristics of PL/I | publisher=Academic Press | publication-date=1981 | conference=History of Programming Languages | last=Radin | first=George | author-link=George Radin | editor-first=Richard L. | editor-last=Wexelblat | doi=10.1145/800025.1198410 | isbn=0127450408 | page=572 | year=1978 }} PL/B{{cite web |url=https://www.sysmaker.com/infopro/x3j15/whatart.htm#why |title=What is PL/B - The Programming Language for Business? |author= | website=sysmaker.com | publisher=Infopro, Inc. |access-date=22 April 2022 |quote="... conversion to an alternate, extended COBOL or to ANSI COBOL is very difficult, if at all possible"}}

| file_ext = .cbl, .cob, .cpy

| wikibooks = COBOL

}}

COBOL ({{IPAc-en|ˈ|k|oʊ|b|ɒ|l|,_|-|b|ɔː|l}}; an acronym for "common business-oriented language") is a compiled English-like computer programming language designed for business use. It is an imperative, procedural, and, since 2002, object-oriented 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 computers, such as large-scale batch and transaction processing jobs. Many large financial institutions were developing new systems in the language as late as 2006, but most programming in COBOL today is purely to maintain existing applications. Programs are being moved to new platforms, rewritten in modern languages, or replaced with other software.{{cite journal |last=Mitchell |first=Robert L. |date=14 March 2012 |title=Brain drain: Where Cobol systems go from here |url=http://www.computerworld.com/article/2502420/data-center/brain-drain-where-cobol-systems-go-from-here.html |journal=Computerworld |language=en-US |access-date=9 February 2015}}

COBOL was designed in 1959 by CODASYL and was partly based on the programming language FLOW-MATIC, designed by Grace Hopper. It was created as part of a U.S. Department of Defense effort to create a portable programming language for data processing. It was originally seen as a stopgap, but the Defense Department promptly pressured computer manufacturers to provide it, resulting in its widespread adoption.{{cite book | url=https://books.google.com/books?id=VCcsTPQ738oC&pg=PA100 | title=The Computer Boys Take Over: Computers, Programmers, and the Politics of Technical Expertise | publisher=MIT Press | year=2009 | page=100 | isbn=978-0262050937 | first=Nathan L. | last=Ensmenger | lccn=2009052638}} It was standardized in 1968 and has been revised five times. Expansions include support for structured and object-oriented programming. The current standard is ISO/IEC 1989:2023.{{sfn|ISO/IEC JTC 1/SC 22/WG 4|2023}}

COBOL statements have prose syntax such as {{code|MOVE x TO y|lang=cobolfree}}, which was designed to be self-documenting and highly readable. However, it is verbose and uses over 300 reserved words compared to the succinct and mathematically inspired syntax of other languages.

The 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, the standard specifies 43 statements, 87 functions, and just one class.

COBOL has been criticized for its verbosity, design process, and poor support for structured programming. These weaknesses often result in monolithic programs that are hard to comprehend as a whole, despite their local readability.

For years, COBOL has been assumed as a programming language for business operations in mainframes,{{Cite web | url=https://www.mainframes.com/COBOL.html |title=Mainframe COBOL Programming}} although in recent years, many COBOL operations have been moved to cloud computing.{{Cite magazine | url=https://www.forbes.com/sites/tomgroenfeldt/2022/05/18/covid-accelerates-banks-mainframe-migration-to-cloud/ |last=Groenfeldt|first=Tom |title=Covid Accelerates Banks' Mainframe Migration to Cloud | magazine=Forbes}}

History and specification

class="wikitable floatright" style="padding-left: 1.5em;"

|+Timeline of COBOL language

Year

! Informal name

! Official Standard

1960

| COBOL-60

| {{n/a}}

1961

| COBOL-61

| {{n/a}}

1963

| COBOL-61 Extended

| {{n/a}}

1965

| COBOL-65

| {{n/a}}

1968

| COBOL-68

| ANSI INCITS X3.23-1968

1974

| COBOL-74

| ANSI INCITS X3.23-1974

1985

| COBOL-85

| ANSI INCITS X3.23-1985
ISO/IEC 1989:1985

2002

| COBOL-2002

| ISO/IEC 1989:2002

2014

| COBOL-2014

| ISO/IEC 1989:2014

2023

| COBOL-2023

| ISO/IEC 1989:2023

=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 US$600,000. At a time when new programming languages were proliferating, the same survey suggested that if a common business-oriented language were used, conversion would be far cheaper and faster.{{sfn|Beyer|2009|p=282}}

On 8 April 1959, Mary K. Hawes, a computer scientist at Burroughs Corporation, called a meeting of representatives from academia, computer users, and manufacturers at the University of Pennsylvania to organize a formal meeting on common business languages.{{Cite journal|last=Gürer|first=Denise|date=1 June 2002|title=Pioneering Women in Computer Science|journal=SIGCSE Bull.|volume=34|issue=2|pages=175–180 |doi=10.1145/543812.543853 |s2cid=2577644|issn=0097-8418}} Representatives included Grace Hopper (inventor of the English-like data processing language FLOW-MATIC), Jean Sammet, and Saul Gorn.{{sfn|Beyer|2009|pp=281–282}}{{sfn|Sammet|1978a|p=200}}

At the April meeting, the group asked the Department of Defense (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,{{ cite web | url = https://www.tpr.org/post/how-cobol-still-powers-global-economy-60-years-old | title = How COBOL Still Powers The Global Economy At 60 Years Old | access-date = 19 July 2019 | first = Paul | last = Flahive | date = 24 May 2019 | website = Texas Public Radio | quote = (Grace Hopper) Nicknamed Grandma Cobol, the code was based on some of her earlier work. She said — after hearing the rumors — one of her collaborators went out and bought a granite tombstone. "He had the word COBOL cut in the front of it. Then he shipped it express collect to Mr. Phillips in the pentagon." The prank on Charles Phillips, a leader for the project at the defense department, got the attention of the powers that be and was a turning point she said. COBOL would go on to become the most widely used and longest lasting computer languages in history. | archive-url = https://web.archive.org/web/20190524035248/https://www.tpr.org/post/how-cobol-still-powers-global-economy-60-years-old | archive-date = 24 May 2019 | df = dmy-all }} who thought that they "thoroughly understood" the DoD's problems. The DoD operated 225 computers, had 175 more 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.{{sfn|Beyer|2009|p=283}}

Charles Phillips agreed to sponsor the meeting, and tasked the delegation with drafting the agenda.{{sfn|Beyer|2009|p=284}}

=COBOL 60=

On 28 and 29 May 1959, a meeting was held at the Pentagon to discuss the creation of a common programming language for business (exactly one year after the Zürich ALGOL 58 meeting). It was attended by 41 people and was chaired by Phillips.{{Cite journal | doi = 10.1109/MAHC.1985.10047| title = Early Meetings of the Conference on Data Systems Languages| journal = IEEE Annals of the History of Computing| volume = 7| issue = 4| pages = 316–325| year = 1985 | s2cid = 35625728}} 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.{{sfn|Sammet|2004|p=104}}

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.{{sfn|Beyer|2009|p=286}}

The meeting resulted in the creation of a steering committee and short, intermediate, and long-range committees. The short-range committee was given until September (three months) to produce specifications for an interim language, which would then be improved upon by the other committees.{{sfn|Conner|1984|p=ID/9}}{{sfn|Sammet|1978a|p=201}} Their official mission, however, was to identify the strengths and weaknesses of existing programming languages; it did not explicitly direct them to create a new language.{{sfn|Sammet|2004|p=104}}

The deadline was met with disbelief by the short-range committee.{{sfn|Bemer|1971|p=132}} One member, Betty Holberton, described the three-month deadline as "gross optimism" and doubted that the language really would be a stopgap.{{sfn|Beyer|2009|p=288}} The steering committee met on 4 June and agreed to name the entire activity the Committee on Data Systems Languages, or CODASYL, and to form an executive committee.{{sfn|Sammet|1978a|p=203}}

The short-range committee members represented six computer manufacturers and three government agencies. The computer manufacturers were Burroughs Corporation, IBM, Minneapolis-Honeywell (Honeywell Labs), RCA, Sperry Rand, and Sylvania Electric Products. The government agencies were the U.S. Air Force, the Navy's David Taylor Model Basin, and the National Bureau of Standards (now the National Institute of Standards and Technology).{{sfn|CODASYL|1969|loc=§ I.2.1.1}} The committee was chaired by Joseph Wegstein of the U.S. National Bureau of Standards. Work began by investigating data descriptions, statements, existing applications, and user experiences.{{sfn|Sammet|1978a|p=204}}

The committee mainly examined the FLOW-MATIC, AIMACO, and COMTRAN programming languages.{{sfn|Sammet|2004|p=104}}{{sfn|CODASYL|1969|loc=§ I.1.2}} The FLOW-MATIC language was particularly influential because it had been implemented and because AIMACO was a derivative of it with only minor changes.{{sfn|Beyer|2009|p=290}}{{cite journal | last = Sammet | first = Jean | author-link = Jean Sammet | title = The Early History of COBOL | journal = ACM SIGPLAN Notices | volume = 13 | issue = 8 | pages = 121–161 | year = 1978 | doi =10.1145/960118.808378 | s2cid = 10743643 }} FLOW-MATIC's inventor, Grace Hopper, also served as a technical adviser to the committee.{{sfn|Bemer|1971|p=132}} FLOW-MATIC's major contributions to COBOL were long variable names, English words for commands, and the separation of data descriptions and instructions.{{sfn|Sammet|1978a|p=217}} Hopper is sometimes called "the mother of COBOL" or "the grandmother of COBOL",{{cite magazine |last=Adams|first=Vicki Porter|date=5 October 1981|title=Captain Grace M. Hopper: the Mother of COBOL |url=https://books.google.com/books?id=JT0EAAAAMBAJ&pg=RA1-PA33|magazine=InfoWorld|volume=3|issue=20|page=33 |issn=0199-6649}}{{cite journal|last=Betts|first=Mitch|date=6 January 1992|title=Grace Hopper, mother of Cobol, dies|url=https://books.google.com/books?id=J-_T3bxgvMwC&pg=PA14|journal=Computerworld |volume=26|issue=1|page=14}}{{cite book|last=Lohr|first=Steve|url=https://books.google.com/books?id=XfPLVx6qS_cC&pg=PA52|title=Go To: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Maverick Scientists, and Iconoclasts—The Programmers Who Created the Software Revolution|publisher=Basic Books|year=2008|isbn=978-0786730766|page=52}} although Jean Sammet, a lead designer of COBOL, said Hopper "was not the mother, creator, or developer of Cobol."{{Cite news | url=https://www.irishtimes.com/life-and-style/people/pioneering-software-engineer-and-cobol-co-designer-1.3111332 |title=Pioneering software engineer and Cobol co-designer|newspaper=The Irish Times }}{{Cite journal |last=Sammet|first=Jean E.|date=March 2000|title=The real creators of Cobol|journal=IEEE Software |volume=17|issue=2|pages=30–32|doi=10.1109/52.841602 |issn=1937-4194|quote=The Short-Range Committee worked diligently from June 1959 on, but there were great difficulties in having a fairly large committee try to create a programming language. In November, the Short-Range Committee chair appointed six people to develop specifications for consideration: William Selden and Gertrude Tierney (IBM), Howard Bromberg and Norman Discount (RCA), and Vernon Reeves and Jean E. Sammet (Sylvania Electric Products). We worked for two full weeks (including some round-the-clock sessions) in November 1959 and sent the proposed specifications to the full Short-Range Committee, which accepted almost all of them. After some editing (by the same six people), we turned in the specifications as a final report in December to the Executive Committee, which accepted them in January 1960. After some further editing, the Government Printing Office issued Cobol 60. [...] [Grace Hopper] did not participate in its work except through the general guidance she gave to her staff who were direct committee members. Thus, while her indirect influence was very important, regrettably the frequent repeated statements that "Grace Hopper developed Cobol" or "Grace Hopper was a codeveloper of Cobol" or "Grace Hopper is the mother of Cobol" are just not correct.}}

IBM's COMTRAN language, invented by Bob Bemer, was regarded as a competitor to FLOW-MATIC{{sfn|Beyer|2009|p=292}}{{sfn|Bemer|1971|p=131}} by a short-range committee made up of colleagues of Grace Hopper.{{sfn|Beyer|2009|p=296}} Some of its features were not incorporated into COBOL so that it would not look like IBM had dominated the design process,{{sfn|Conner|1984|p=ID/9}} and Jean Sammet said in 1981 that there had been a "strong anti-IBM bias" from some committee members (herself included).{{sfn|Sammet|1978a|p=221}} 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.{{sfn|Beyer|2009|p=291}}

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 [so they] wouldn't try to knock us out.".{{cite web | url=http://archive.computerhistory.org/resources/text/Oral_History/Hopper_Grace/102702026.05.01.pdf | title=Oral History of Captain Grace Hopper | publisher=Computer History Museum | date=December 1980 | access-date=28 June 2014 | page=37 | archive-url=https://web.archive.org/web/20171225202555/http://archive.computerhistory.org/resources/text/Oral_History/Hopper_Grace/102702026.05.01.pdf | archive-date=25 December 2017 | url-status=dead }}

Features from COMTRAN incorporated into COBOL included formulas,{{sfn|Sammet|1978a|p=218}} the #PICTURE clause,{{sfn|Marcotty|1978a|p=268}} an improved IF statement, which obviated the need for GO TOs, and a more robust file management system.{{sfn|Beyer|2009|p=292}}

The usefulness of the committee's work was a subject of great debate. While some members thought the language had too many compromises and was the result of design by committee, others felt it was better than the three languages examined. Some felt the language was too complex; others, too simple.{{sfn|Sammet|1978a|pp=205–206}}

Controversial features included those some considered useless or too advanced for data processing users. Such features included Boolean expressions, formulas, and table {{dfn|subscripts}} (indices).{{sfn|Sammet|1978a|loc=Figure 8}}{{sfn|Sammet|1978a|pp=230–231}} Another point of controversy was whether to make keywords context-sensitive and the effect that would have on readability.{{sfn|Sammet|1978a|loc=Figure 8}} Although context-sensitive keywords were rejected, the approach was later used in PL/I and partially in COBOL from 2002.{{sfn|ISO/IEC JTC 1/SC 22/WG 4|2001|p=846}} Little consideration was given to interactivity, interaction with operating systems (few existed at that time), and functions (thought of as purely mathematical and of no use in data processing).{{sfn|Sammet|1978a|p=220}}{{sfn|Sammet|1978a|p=228}}

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 committee was given until December to improve it.{{sfn|Bemer|1971|p=132}}

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).{{sfn|Sammet|1978a|p=210}} It is unclear who coined the name "COBOL",{{sfn|Bemer|1971|p=132: We can't find a single individual who admits coining the acronym "COBOL"}}{{sfn|Sammet|1978a|p=210: The next day, the name COBOL was finally agreed to as an acronym for COmmon Business Oriented Language. Unfortunately, my notes do not show who made that suggestion}} although Bob Bemer later claimed it had been his suggestion.{{cite news | url=https://www.washingtonpost.com/wp-dyn/articles/A4138-2004Jun24.html | title=Computer Pioneer Bob Bemer, 84 | newspaper=The Washington Post | date=25 June 2004 | access-date=28 June 2014 | page=B06 | first=Patricia | last=Sullivan}}{{cite web|url=http://www.bobbemer.com/arranga.htm|title=THE COBOL REPORT - Interview with Bob Bemer - the Father of COBOL|url-status=dead|archive-url=https://web.archive.org/web/20180402200259/http://www.bobbemer.com/arranga.htm|archive-date=2 April 2018}}{{cite web|url=http://cobolreport.com/cobolreport/archives/TCR_bemer.htm|title=THE COBOL REPORT - Interview with Bob Bemer - the Father of COBOL|url-status=dead|archive-url=https://web.archive.org/web/20031223115509/http://cobolreport.com/cobolreport/archives/TCR_bemer.htm|archive-date=23 December 2003}}

In October, the intermediate-range committee received copies of the FACT language specification created by Roy Nutt. Its features impressed the committee so much that they passed a resolution to base COBOL on it.{{sfn|Beyer|2009|p=293}}

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,{{sfn|Bemer|1971|p=132}} 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.{{sfn|Beyer|2009|p=294}}

It soon became apparent that the committee was too large to make any further progress quickly. A frustrated Howard Bromberg bought a $15 tombstone with "COBOL" engraved on it and sent it to Charles Phillips to demonstrate his displeasure.{{efn|The tombstone is currently at the Computer History Museum.{{cite book | title=COBOL Tombstone | year=1960 | url=http://www.computerhistory.org/collections/catalog/X572.85 | publisher=Computer History Museum | access-date=29 June 2014}}}}{{cite journal | url=http://ed-thelen.org/comp-hist/TCMR-V13.pdf | title=The Story of the COBOL Tombstone | journal=The Computer Museum Report | date=Summer 1985 | access-date=29 June 2014 | volume=13 | pages=8–9 | archive-url=https://web.archive.org/web/20140403015336/http://ed-thelen.org/comp-hist/TCMR-V13.pdf | archive-date=3 April 2014 | url-status=live }}{{sfn|Bemer|1971|p=130}}

A subcommittee was formed to analyze existing languages and was made up of six individuals:{{sfn|Sammet|2004|p=104}}{{sfn|Beyer|2009|p=289}}

  • William Selden and Gertrude Tierney of IBM,
  • Howard Bromberg and Howard Discount of RCA,
  • Vernon Reeves and Jean E. Sammet of Sylvania Electric Products.

The subcommittee did most of the work creating the specification, leaving the short-range committee to review and modify their work before producing the finished specification.{{sfn|Sammet|2004|p=104}}

The specifications were approved by the executive committee on 8 January 1960, and sent to the government printing office, which printed them 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.{{sfn|CODASYL|1969|loc=§ I.1.1}}

The CODASYL Executive Committee later created the COBOL Maintenance Committee to answer questions from users and vendors and to improve and expand the specifications.{{sfn|Brown|1976|p=47}}

During 1960, the list of manufacturers planning to build COBOL compilers grew. By September, five more manufacturers had joined CODASYL (Bendix, Control Data Corporation, General Electric (GE), National Cash Register, and Philco), 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 planned to replace their language, CODEL, with COBOL.{{sfn|Bemer|1971|p=133}}

Meanwhile, RCA and Sperry Rand worked on creating COBOL compilers. The first COBOL program ran on 17 August on an RCA 501.{{sfn|Beyer|2009|p=297}} On 6 and 7 December, the same COBOL program (albeit with minor changes) ran on an RCA computer and a Remington-Rand Univac computer, demonstrating that compatibility could be achieved.{{cite book | url=https://books.google.com/books?id=KKmiw-_2gYIC&pg=PT124 | title=Grace Hopper: Admiral of the Cyber Sea | publisher=US Naval Institute Press | isbn=978-1612512655 | date=10 November 2012 | last=Williams | first=Kathleen Broome | oclc=818867202}}

The relative influence of the languages that were used is still indicated in the recommended advisory printed in all COBOL reference manuals:

{{blockquote|COBOL is an industry language and is not the property of any company or group of companies, or of any organization or group of organizations.

No warranty, expressed or implied, is made by any contributor or by the CODASYL COBOL Committee as to the accuracy and functioning of the

programming system and language. Moreover, no responsibility is assumed by any contributor or by the committee in connection therewith. The authors and copyright holders of the copyrighted material used herein are as follows:

{{quote|style=font-size: inherit|FLOW-MATIC (trademark of Unisys Corporation), Programming for the UNIVAC (R) I and II, Data Automation Systems, copyrighted 1958, 1959, by Unisys Corporation; IBM Commercial Translator Form No. F28-8013, copyrighted 1959 by IBM; FACT, DSI 27A5260-2760, copyrighted 1960 by Minneapolis-Honeywell.}}

They have specifically authorized the use of this material, in whole or in part, in the COBOL specifications. Such authorization extends to the reproduction and use of COBOL specifications in programming manuals or similar publications.Compaq Computer Corporation: Compaq COBOL Reference Manual, Order Number: AA–Q2G0F–TK October 2000, Page xviii; Fujitsu Corporation: Net Cobol Language Reference, Version 15, January 2009; IBM Corporation: Enterprise COBOL for z/OS Language Reference, Version 4 Release 1, SC23-8528-00, December 2007}}

=COBOL-61 to COBOL-65=

{{quote box

| quote=It is rather unlikely that Cobol will be around by the end of the decade.

| width=30%

| source=Anonymous, June 1960{{cite journal | url=https://books.google.com/books?id=CLbHc0Acrm4C&pg=RA1-PA67 | title=In defense of Cobol | journal=Computerworld | volume=18 | issue=24 | page=ID/19 | first=Jerome | last=Garfunkel | date=11 November 1984}}

}}

Many logical flaws were found in COBOL 60, leading General Electric's Charles Katz to warn that it could not be interpreted unambiguously. A reluctant short-term committee performed a total cleanup, and, by March 1963, it was reported that COBOL's syntax was as definable as ALGOL's, although semantic ambiguities remained.{{sfn|Bemer|1971|p=133}}

Early COBOL compilers were primitive and slow. COBOL is a difficult language to write a compiler for, due to the large syntax and many optional elements within syntactic constructs, as well as the need to generate efficient code for a language with many possible data representations, implicit type conversions, and necessary set-ups for I/O operations.{{cite book |last=Pratt |first=Terrence W. |date=1975 |title=Programming Languages: Design and Implementation |location=Englewood Cliffs, New Jersey | publisher= Prentice Hall |isbn=0-13-730432-3 |pages=361–362, 381–382}} 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.{{sfn|Bemer|1971|p=134}}

In late 1962, IBM announced that COBOL would be their primary development language and that development of COMTRAN would cease.{{sfn|Bemer|1971|p=134}}

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.{{sfn|Brown|1976|p=48}} The added facilities corrected flaws identified by Honeywell in late 1959 in a letter to the short-range committee.{{sfn|Beyer|2009|p=297}} COBOL Edition 1965 brought further clarifications to the specifications and introduced facilities for handling mass storage files and tables.{{sfn|CODASYL|1969|loc=§ I.2.2.4}}

=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) formed groups to create standards. ANSI produced USA Standard COBOL X3.23 in August 1968, which became the cornerstone for later versions.{{sfn|CODASYL|1969|loc=§ I.2.3}} This version was known as American National Standard (ANS) COBOL and was adopted by ISO in 1972.{{cite encyclopedia | url=http://dl.acm.org/citation.cfm?id=1074734 | title=Programming language standards | encyclopedia=Encyclopedia of Computer Science | publisher=Wiley | year=2003 | page=1467 | isbn=978-0470864128 | last1=Follet | first1=Robert H. | last2=Sammet | first2=Jean E. | author-link2=Jean E. Sammet | edition=4th | editor1-first=Anthony | editor1-last=Ralston | editor2-first=Edwin D. | editor2-last=Reilly | editor3-first=David | editor3-last=Hemmendinger |url-access=subscription }}

=COBOL-74=

By 1970, COBOL had become the most widely used programming language in the world.{{sfn|Beyer|2009|p=301}}

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 inclusion features.{{sfn|Brown|1976|p=49}}

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.{{sfn|Brown|1976|p=52}} The Programming Language Committee also liaised with ECMA and the Japanese COBOL Standard committee.{{sfn|Brown|1976|p=49}}

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 also lacked the funds to make public documents, such as minutes of meetings and change proposals, freely available.{{cite journal | url=https://books.google.com/books?id=JBUJf4n2QxkC&pg=PT10 | title=Few Realise Wasted Resources of Local DP Schools | journal=Computerworld | volume=6 | issue=31 | pages=11 | first=Alan | last=Taylor | date=2 August 1972}}

In 1974, ANSI published a revised version of (ANS) COBOL, containing new features such as file organizations, the {{code|DELETE}} statement{{cite book | url=https://books.google.com/books?id=Cs1RAQAAIAAJ&pg=PA87 | title=Programming in COBOL: A Course of Twelve Television Lectures | publisher=Manchester University Press | year=1974 | page=87 | isbn=978-0719005923 | last=Triance | first=J. M.}} and the segmentation module.{{Sfn|Klein|2010|p=16}} Deleted features included the {{code|NOTE}} statement, the {{code|EXAMINE}} statement (which was replaced by {{code|INSPECT}}), 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.{{cite report |section=1974 Standard (X3.23–1974) |title=Programming Language Standards—Who Needs Them? |date=May 1977 |url=http://apps.dtic.mil/dtic/tr/fulltext/u2/a039740.pdf |access-date=7 January 2014 |pages=19–21 |first1=George N. |last1=Baird |first2=Paul |last2=Oliver |publisher=Department of the Navy |archive-url= https://web.archive.org/web/20140107192439/http://www.dtic.mil/dtic/tr/fulltext/u2/a039740.pdf |archive-date=7 January 2014 |url-status=live}} The report writer was slated to be removed from COBOL but was reinstated before the standard was published.{{cite journal |url=https://books.google.com/books?id=8pMVcgpPyVMC&pg=PA17 |title='Spotty' Availability A Problem... |page=17 |date=23 July 1975 |last=Culleton | first=John R. Jr. |journal=Computerworld |volume=9 |issue=30}}{{cite journal |url=https://books.google.com/books?id=X_3_D4RqzvIC&pg=PA20 |title=Does Cobol's Report Writer Really Miss the Mark? |journal=Computerworld |volume=9 |issue=25 |page=20 |first=Williams B. |last=Simmons |date=18 June 1975}} 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".{{cite journal | url=https://books.google.com/books?id=d514ApKzvjYC | title=User Threatens Suit Over Ansi Cobol-80 | journal=Computerworld | volume=15 | issue=4 | pages=1, 8 | first=Rita | last=Shoor | date=26 January 1981}} Later that year, the Data Processing Management Association (DPMA) said it was "strongly opposed" to the new standard, citing "prohibitive" conversion costs and enhancements that were "forced on the user".{{cite journal | url=https://books.google.com/books?id=1REkdf3I86oC | title=DPMA Takes Stand Against Cobol Draft | journal=Computerworld | volume=15 | issue=43 | pages=1–2 | date=26 October 1981 | first=Rita | last=Shoor}}{{cite journal | url=https://books.google.com/books?id=zrOC44tBR68C&pg=PA8 | title=Revised Cobol standard may be ready in late '85 | journal=Computerworld | volume=19 | issue=37 | pages=1, 8 | first=John | last=Gallant | date=16 September 1985}}

During the first public review period, the committee received 2,200 responses, of which 1,700 were negative form letters.{{cite journal|url=https://books.google.com/books?id=zrOC44tBR68C&pg=PA41 | title=Expert addresses Cobol 85 standard | journal=Computerworld | volume=19 | issue=37 | pages=41, 48 | author= | date=16 September 1985}} 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.{{cite journal| url=https://books.google.com/books?id=Wz-oh7ZQo8MC | title=Responses to Cobol-80 Overwhelmingly Negative | journal=Computerworld | volume=16 | issue=11 | pages=1, 5 | date=15 March 1982 | first=Lois | last=Paul}}

ISO TC97-SC5 installed in 1979 the international COBOL Experts Group, on initiative of Wim Ebbinkhuijsen. 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 made 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.{{cite journal | url=https://books.google.com/books?id=Of5OA6T_6UIC&pg=PA1 | title=Study Sees Few Problems Switching to Cobol-8X | journal=Computerworld | volume=17 | issue=17 | pages=1, 6 | first=Lois | last=Paul | date=25 April 1983}} A year later, DEC released a VAX/VMS COBOL-80, and 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 and debugging.{{cite journal | url=https://books.google.com/books?id=1qju5_k3q9AC&pg=PA1 | title=DEC users get head start implementing Cobol-80 | journal=Computerworld | volume=18 | issue=47 | pages=1, 6 | first=Paul | last=Gillin | date=19 November 1984}}

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{{cite web |url=https://public.support.unisys.com/aseries/docs/clearpath-mcp-17.0/pdf/86001518-316.pdf |title=COBOL ANSI-85 Programming Reference Manual |author=ClearPath Enterprise Servers |date=April 2015 |website=public.support.unisys.com |publisher=Unisys |access-date=29 April 2022}} were added, such as:{{sfn|Garfunkel|1987|p=150}}{{cite book | url=https://books.google.com/books?id=N066w1XgJXcC&pg=PA438 | title=COBOL Programming: Problems and Solutions | publisher=McGraw-Hill Education | pages=438–451 | isbn=978-0074603185 | first1=M. K. | last1=Roy | first2=D. Ghost | last2=Dastidar | date=1 June 1989 | edition=2nd | section=Features of COBOL-85}}

  • Scope terminators (END-IF, END-PERFORM, END-READ, etc.)
  • Nested subprograms
  • CONTINUE, a no-operation statement
  • EVALUATE, a switch statement
  • 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 amendment introduced intrinsic functions and the other provided corrections.

=COBOL 2002 and object-oriented COBOL=

In 1997, Gartner Group estimated that there were a total of 200 billion lines of COBOL in existence, which ran 80% of all business programs.{{efn |name=Gartner ubiquity}}{{cite web |url=http://fcw.com/Articles/2009/07/13/TECH-COBOL-turns-50.aspx |title=Cobol remains old standby at agencies despite showing its age |publisher=Public Sector Media Group |work=FCW |access-date=26 April 2014 |date=9 July 2009 |last=Robinson |first=Brian |archive-date=27 April 2014 |archive-url=https://web.archive.org/web/20140427010019/http://fcw.com/Articles/2009/07/13/TECH-COBOL-turns-50.aspx |url-status=dead }}

In the early 1990s, work began on adding object-oriented programming in the next full revision of COBOL. Object-oriented features were taken from C++ and Smalltalk.{{cite web |url=http://collaboration.cmc.ec.gc.ca/science/rpn/biblio/ddj/Website/articles/DDJ/1995/9510/9510e/9510e.htm |title=COBOL '97: A Status Report |work=Dr. Dobb's Journal |date=October 1995 |access-date=21 April 2014 |last1=Saade |first1=Henry |first2=Ann |last2=Wallace |archive-url=https://web.archive.org/web/20140422232229/http://collaboration.cmc.ec.gc.ca/science/rpn/biblio/ddj/Website/articles/DDJ/1995/9510/9510e/9510e.htm |archive-date=22 April 2014 |url-status=dead }}{{cite book |url=https://books.google.com/books?id=posN1cl6XFUC&pg=PA15 |title=Object-Oriented COBOL |publisher=Cambridge University Press |page=15 |isbn=978-0132611404 |first1=Edmund C. |last1=Arranga |first2=Frank P. |last2=Coyle |date=February 1998 |quote=Object-Oriented COBOL's style reflects the influence of Smalltalk and C++.}}

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, Fujitsu, 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.{{cite web |url=http://www.cobolstandards.com/ |title=COBOL Standards |access-date=2 September 2014 |archive-url=https://web.archive.org/web/20040331054413/http://www.cobolstandards.com/ |archive-date=31 March 2004 |publisher=Micro Focus |url-status=dead}}

Fujitsu/GTSoftware,{{cite web |url=http://www.netcobol.com/product/netcobol-for-net/ |title=NetCOBOL for .Net |publisher=GTSoftware |work=netcobol.com |year=2013 |access-date=29 January 2014 |url-status=dead |archive-url=https://web.archive.org/web/20140708210107/http://www.netcobol.com/product/netcobol-for-net/ |archive-date=8 July 2014}} Micro Focus introduced object-oriented COBOL compilers targeting the .NET Framework.

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.{{cite journal |url=https://books.google.com/books?id=VQhbdDusHcsC&pg=RA1-PA60 |title=A list of Codasyl Cobol features |journal=Computerworld |date=10 September 1984 |access-date=8 June 2014 |author= |page=ID/28 |volume=18 |issue=37}} These other features included:{{sfn|ISO/IEC JTC 1/SC 22/WG 4|2001|loc=Annex F}}{{sfn|Klein|2010|p=21}}

Three corrigenda were published for the standard: two in 2006 and one in 2009.{{cite web |url=http://www.cobolstandard.info/wg4/wg4.html |title=JTC1/SC22/WG4 – COBOL |publisher=ISO |date=30 June 2010 |access-date=27 April 2014 |archive-url=https://web.archive.org/web/20140214225220/http://www.cobolstandard.info/wg4/wg4.html |archive-date=14 February 2014 |url-status=dead}}

=COBOL 2014=

Between 2003 and 2009, three technical reports were produced describing object finalization, XML processing and collection classes 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 test suite, which had been used to test compiler conformance. The standardization process was also found to be slow and under-resourced.{{cite web | url=http://www.cobolstandard.info/j4/files/08-0034.pdf | title=Thoughts on the Future of COBOL Standardization | date=27 February 2008 | access-date=14 August 2014 | first1=John | last1=Billman | first2=Huib | last2=Klink | archive-url=https://web.archive.org/web/20090711032647/http://www.cobolstandard.info/j4/files/08-0034.pdf | archive-date=11 July 2009 | url-status=dead}}

COBOL 2014 includes the following changes:{{sfn|ISO/IEC JTC 1/SC 22/WG 4|2014|loc=Annex E}}

  • Portable arithmetic results have been replaced by IEEE 754 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){{cite web | url=http://www.microfocus.com/Standards/ | title=J4: COBOL Standardization | publisher=Micro Focus | date=2 December 1998 | access-date=12 July 2014 | archive-url=https://web.archive.org/web/19990224043617/http://www.microfocus.com/Standards/ | archive-date=24 February 1999 | url-status=dead | first=Don | last=Schricker}}

=COBOL 2023=

The COBOL 2023 standard added a few new features:

  • Asynchronous messaging syntax using the SEND and RECEIVE statements{{sfn|ISO/IEC JTC 1/SC 22/WG 4|2023|loc=§ E.3.1}}
  • A transaction processing facility with COMMIT and ROLLBACK{{sfn|ISO/IEC JTC 1/SC 22/WG 4|2023|loc=§ E.3.1}}
  • XOR logical operator{{sfn|ISO/IEC JTC 1/SC 22/WG 4|2023|loc=§ E.3.1}}
  • The CONTINUE statement can be extended as to pause the program for a specified duration{{sfn|ISO/IEC JTC 1/SC 22/WG 4|2023|loc=§ E.3.2}}
  • A DELETE FILE statement{{sfn|ISO/IEC JTC 1/SC 22/WG 4|2023|loc=§ E.3.2}}
  • LINE SEQUENTIAL file organization{{sfn|ISO/IEC JTC 1/SC 22/WG 4|2023|loc=§ 12.4.4.9}}
  • Defined infinite looping with PERFORM UNTIL EXIT{{sfn|ISO/IEC JTC 1/SC 22/WG 4|2023|loc=§ E.3.2}}
  • SUBSTITUTE intrinsic function allowing for substring substitution of different length{{sfn|ISO/IEC JTC 1/SC 22/WG 4|2023|loc=§ E.3.2}}
  • CONVERT function for base-conversion{{sfn|ISO/IEC JTC 1/SC 22/WG 4|2023|loc=§ E.3.2}}
  • Boolean shifting operators{{sfn|ISO/IEC JTC 1/SC 22/WG 4|2023|loc=§ 8.7.2}}

There is as yet no known complete implementation of this standard.{{citation needed|date=August 2023}}

Legacy

COBOL programs are used globally in governments and various industries including retail, travel, finance, and healthcare. Testimony before the House of Representatives in 2016 indicated that COBOL is still in use by many federal agencies.{{cite web |last=Powner |first=David A. |date=25 May 2016 |title=Federal Agencies Need to Address Aging Legacy Systems |url=https://www.gao.gov/assets/680/677454.pdf |archive-url=https://web.archive.org/web/20160615044750/https://www.gao.gov/assets/680/677454.pdf |archive-date=15 June 2016 |access-date=19 July 2019 |website=Government Accountability Office |page=18 |quote=Several agencies, such as the Department of Agriculture (USDA), DHS, HHS, Justice, Treasury, and VA, reported using Common Business Oriented Language (COBOL)—a programming language developed in the late 1950s and early 1960s—to program their legacy systems. It is widely known that agencies need to move to more modern, maintainable languages, as appropriate and feasible.}}

COBOL currently runs on diverse operating systems such as z/OS, z/VSE, VME, Unix, NonStop OS, OpenVMS and Windows. In 1997, the Gartner Group reported that 80% of the world's business ran on COBOL with over 200 billion lines of code{{efn |name=Gartner ubiquity}} and 5 billion lines more being written annually.{{cite journal |url=http://proc.isecon.org/2000/126/ISECON.2000.Kizior.pdf | title=Does COBOL Have a Future? |access-date=30 September 2012 |first1=Ronald J. |last1=Kizior |first2=Donald |last2=Carr |first3=Paul |last3=Halpern |journal=The Proceedings of the Information Systems Education Conference 2000 |volume=17 |issue=126 | url-status=dead | archive-url=https://web.archive.org/web/20160817115437/http://proc.isecon.org/2000/126/ISECON.2000.Kizior.pdf | archive-date=17 August 2016}} As of 2020, COBOL ran background processes 95% of the time a credit or debit card was swiped.{{Cite web |last=Thompson |first=Clive |date=2020-11-10 |title=The Code that Controls Your Money |url=https://www.wealthsimple.com/en-ca/magazine/cobol-controls-your-money |url-status=live |archive-url=https://archive.today/20210909050522/https://www.wealthsimple.com/en-ca/magazine/cobol-controls-your-money |archive-date=2021-09-09 |access-date=2025-04-19 |website=www.wealthsimple.com |language=en-ca}}

= Y2K =

Near the end of the 20th century, the year 2000 problem (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.{{cite web |url=https://homepages.wmich.edu/~rea/Y2K/FAQ.html |title=Frequently Asked Questions (FAQ) About the Y2K Problem |last=White |first=Doug |date=12 July 1998 |website=homepages.wmich.edu |access-date=29 April 2022 |quote=Thus, the main problem of Y2K is the problem of incorrect results when date mathematics are conducted. |archive-date=7 November 2021 |archive-url=https://web.archive.org/web/20211107132002/https://homepages.wmich.edu/~rea/Y2K/FAQ.html |url-status=dead }} Some studies attribute as much as "24% of Y2K software repair costs to Cobol".{{cite journal |url=https://ieeexplore.ieee.org/document/841605 |title=Some strategic Y2K blessings |last=Kappelman |first=Leon A. |date=2000 |journal=IEEE Software |pages=42–46 |volume=17 |issue=2|doi=10.1109/52.841605 }} After the clean-up effort put into these programs for Y2K, a 2003 survey found that many remained in use.{{sfn|Carr|Kizior|2003|p=16}} The authors said that the survey data suggest "a gradual decline in the importance of COBOL in application development over the [following] 10 years unless ... integration with other languages and technologies can be adopted".{{sfn|Carr|Kizior|2003|p=10}}

= Modernization efforts =

In 2006 and 2012, Computerworld surveys (of 352 readers) found that over 60% of organizations used COBOL (more than C++ and Visual Basic .NET) and that for half of those, COBOL was used for the majority of their internal software.{{cite journal |title=Cobol: Not Dead Yet |url=https://www.computerworld.com/article/1709161/cobol-not-dead-yet.html |access-date=10 December 2024 |journal=Computerworld |date=4 October 2006 |last=Mitchell |first=Robert L.}}{{cite journal |url=http://www.computerworld.com/s/article/9225099/Cobol_brain_drain_Survey_results |access-date=27 April 2014 |title=Cobol brain drain: Survey results |journal=Computerworld |date=14 March 2012 |author= |archive-date=27 April 2014 |archive-url=https://web.archive.org/web/20140427203258/http://www.computerworld.com/s/article/9225099/Cobol_brain_drain_Survey_results |url-status=dead }} 36% of managers said they planned to migrate from COBOL, and 25% said that they would do so if not for the expense of rewriting legacy code. Alternatively, some businesses have migrated their COBOL programs from mainframes to cheaper, faster hardware.

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 COBOL 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.{{cite magazine |url=https://ibmsystemsmag.com/IBM-Z/10/2019/closing-cobol-programming-skills-gap |title=Closing the COBOL Programming Skills Gap |last1=Teplitzky |first1=Phil |access-date=11 June 2020 |magazine=IBM Systems Magazine, IBM Z |date=25 October 2019 |archive-date=13 April 2020 |archive-url=https://web.archive.org/web/20200413033628/https://ibmsystemsmag.com/IBM-Z/10/2019/closing-cobol-programming-skills-gap |url-status=dead}}

Several banks have undertaken multi-year COBOL modernization efforts, sometimes resulting in widespread service disruptions that result in fines.{{Cite news |last=Megaw |first=Nicholas |date=2018-04-25 |title=TSB's 'flawless' IT migration turns into chaos for its customers |url=https://www.ft.com/content/cf410e20-48a7-11e8-8ee8-cae73aab7ccb |access-date=2025-04-19 |work=Financial Times}}

During the COVID-19 pandemic 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 was put on hold.{{cite web |url= https://www.cnn.com/2020/04/08/business/coronavirus-cobol-programmers-new-jersey-trnd/index.html |title=Wanted urgently: People who know a half century-old computer language so states can process unemployment claims |first=Alicia |last=Lee |date=8 April 2020 |access-date=8 April 2020 |work=CNN}} Similarly, the US Internal Revenue Service rushed to patch its COBOL-based Individual Master File in order to disburse the tens of millions of payments mandated by the Coronavirus Aid, Relief, and Economic Security Act.{{cite news |last1=Long |first1=Heather |last2=Stein |first2=Jeff |last3=Rein |first3=Lisa |last4=Romm |first4=Tony |title=Stimulus checks and other coronavirus relief hindered by dated technology and rocky government rollout |newspaper=The Washington Post |date=17 April 2020 |access-date=19 April 2020 |url= https://www.washingtonpost.com/business/2020/04/17/stimulus-unemployment-checks-delays-government-delays/}}

Features

=Syntax=

COBOL has an English-like syntax, which is used to describe nearly everything in COBOL programs. For example, a condition can be expressed as  {{code|x IS GREATER THAN y|lang=cobolfree}} or more concisely as  {{code|x GREATER y|lang=cobolfree}}  or  {{code|x > y|lang=cobolfree}}. More complex conditions can be abbreviated by removing repeated conditions and variables. For example,  {{code|1=a > b AND a > c OR a = d|lang=cobolfree}}  can be shortened to {{code|1=a > b AND c OR = d|lang=cobolfree}}. To support this syntax, COBOL has over 300 keywords.{{sfn|ISO/IEC JTC 1/SC 22/WG 4|2014|loc=§ 8.9}}{{efn|Vendor-specific extensions cause many implementations to have far more: one implementation recognizes over 1,100 keywords.{{cite web | url=http://documentation.microfocus.com/help/topic/com.microfocus.eclipse.infocenter.visualcobol.vs2013/HRLHLHARES01U005.html | title=Reserved Words Table | publisher=Micro Focus | work=Micro Focus Visual COBOL 2.2 COBOL Language Reference | access-date=3 March 2014}}}} Some of the keywords are simple alternative or pluralized spellings of the same word, which provides for more grammatically appropriate statements and clauses; e.g., the {{code|IN}} and {{code|OF}} keywords can be used interchangeably, as can {{code|TIME}} and {{code|TIMES}}, and {{code|VALUE}} and {{code|VALUES}}.

Each COBOL program is made up of four basic lexical items: words, literals, picture character-strings (see {{slink||PICTURE clause}}) 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. {{code|12}}) and strings (e.g. {{code|'Hello!'}}).{{sfn|ISO/IEC JTC 1/SC 22/WG 4|2014|loc=§ 8.3.1.2}} Separators include the space character and commas and semi-colons followed by a space.{{sfn|ISO/IEC JTC 1/SC 22/WG 4|2014|loc=§ 8.3.2}}

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. The data division is used to declare variables and parameters. 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 using braces, brackets, bars and underlining.{{cite web | url=https://users.cs.jmu.edu/adamses/Web/CS%20430%20Fall%202004/Student%20Project%20Work/Akanni%20-%20COBOL/COBOL%20Tutorial%20HTML-Pages/Introduction%20to%20COBOL.htm | title=Introduction to COBOL | publisher=James Madison University | access-date=10 December 2024}} The metalanguage was developed for the original COBOL specifications.

class="wikitable"

|+ Elements of COBOL's metalanguage

Element

! Appearance

! Function

All capitals

| EXAMPLE

| Reserved word

Underlining

| {{underline|EXAMPLE}}

| The reserved word is compulsory

Braces

| { }

| Only one option may be selected

Brackets

| []

| Zero or one options may be selected

Ellipsis

| ...

| The preceding element may be repeated

rowspan="2" | Bars

| {{{pipe}} {{pipe}}}

| One or more options may be selected. Any option may only be selected once.

[{{pipe}} {{pipe}}]

| Zero or more options may be selected. Any option may only be selected once.

As an example, consider the following description of an ADD statement:

\begin{array}{l}

\underline{\text{ADD}}\,

\begin{Bmatrix}

\text{identifier-1} \\

\text{literal-1}

\end{Bmatrix}\dots

\;\underline{\text{TO}}\,\left\{\text{identifier-2}\,\left[\,\underline{\text{ROUNDED}}\,\right]\right\}\dots \\[1em]

\quad

\left[\left|\begin{array}{l}

\text{ON}\,\underline{\text{SIZE}}\,\underline{\text{ERROR}}\,\text{imperative-statement-1} \\

\underline{\text{NOT}}\,\text{ON}\,\underline{\text{SIZE}}\,\underline{\text{ERROR}}\,\text{imperative-statement-2}

\end{array}\right|\right] \\[1em]

\quad

\left[\,\underline{\text{END-ADD}}\,\right]

\end{array}

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=

Image:IBM keypunch deck for Cobol student program at New York University 1979.jpg

File:Original XEDIT.png

The height of COBOL's popularity coincided with the era of keypunch machines and punched cards. 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.{{sfn|McCracken|1976|pp=2, 6–9}}

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:

class="wikitable"
Name

! Column(s)

! Usage

Sequence number area

| 1–6

| Originally used for card/line numbers (facilitating mechanical punched card sorting to assure intended program code sequence after manual editing/handling), this area is ignored by the compiler

Indicator area

| 7

| The following characters are allowed here:

  • * – Comment line
  • / – Comment line that will be printed on a new page of a source listing
  • - – Continuation line, where words or literals from the previous line are continued
  • D – Line enabled in debugging mode, which is otherwise ignored
Area A

| 8–11

| This contains: DIVISION, SECTION and procedure headers; 01 and 77 level numbers and file/report descriptors

Area B

| 12–72

| Any other code not allowed in Area A

Program name area

| 73–

| Historically up to column 80 for punched cards, it is used to identify the program or sequence the card belongs to

In COBOL 2002, Areas A and B were merged to form the program-text area, which now ends at an implementor-defined column.{{sfn|ISO/IEC JTC 1/SC 22/WG 4|2001|loc=§ F.2}}

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.{{sfn|ISO/IEC JTC 1/SC 22/WG 4|2001|loc=§ F.2}}

=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 have been in COBOL since 2002. Classes have factory objects, containing class methods and variables, and instance objects, containing instance methods and variables.{{sfn|ISO/IEC JTC 1/SC 22/WG 4|2014|loc=§ D.18.2}} Inheritance and interfaces provide polymorphism. Support for generic programming 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 {{code|INVOKE}} statement, which acts similarly to {{code|CALL}}, or through inline method invocation, which is analogous to using functions.{{sfn|ISO/IEC JTC 1/SC 22/WG 4|2014|loc=§ D.18}}

  • > 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 property (programming) clause, which leaves external code no way to access it.{{sfn|ISO/IEC JTC 1/SC 22/WG 4|2014|p=108}} Method overloading was added in COBOL 2014.{{sfn|ISO/IEC JTC 1/SC 22/WG 4|2014|p=896}}

=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 {{dfn|organizations}}: sequential, indexed and relative. In sequential files, records are contiguous and must be traversed sequentially, similarly to a linked list. 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, but other, {{dfn|alternate}}, record keys need not be unique. Implementations of indexed files vary between vendors, although common implementations, such as C-ISAM and VSAM, are based on IBM's ISAM. Other implementations are Record Management Services on OpenVMS and Enscribe on HPE NonStop (Tandem). 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.{{sfn|ISO/IEC JTC 1/SC 22/WG 4|2014|loc=§ D.2.1}}

A common non-standard extension is the {{dfn|line sequential}} organization, used to process text files. Records in a file are terminated by a newline and may be of varying length.{{cite web | url=http://supportline.microfocus.com/documentation/books/nx30books/fhorgs.htm | title=File Organizations | publisher=Micro Focus | work=File Handling | date=1998 | access-date=27 June 2014 | archive-date=4 March 2016 | archive-url=https://web.archive.org/web/20160304091459/http://supportline.microfocus.com/documentation/books/nx30books/fhorgs.htm | url-status=dead }}

=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 variables; the local-storage section, for automatic variables; the linkage section, for parameters and the return value; the report section and the screen section, for text-based user interfaces.

==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 {{dfn|records}}. Items that have subordinate aggregate data are called {{dfn|group items}}; those that do not are called {{dfn|elementary items}}. Level-numbers used to describe standard data items are between 1 and 49.{{sfn|ISO/IEC JTC 1/SC 22/WG 4|2014|loc=§ 8.5.1.2}}{{sfn|Cutler|2014|loc=Appendix A}}

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 {{code|num}} and group item {{code|the-date}} are subordinate to the record {{code|some-record}}, while elementary items {{code|the-year}}, {{code|the-month}}, and {{code|the-day}} are part of the group item {{code|the-date}}.

Subordinate items can be disambiguated with the {{code|IN}} (or {{code|OF}}) 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 {{code|the-year}}, {{code|the-month}}, and {{code|the-day}} 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 {{code|sale-date}} group, the programmer would use {{code|the-year IN sale-date}} (or the equivalent {{code|the-year OF sale-date}}). 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 {{dfn|{{code|RENAMES}} clause}}, is rarely used{{cite book | title=Sams Teach Yourself COBOL in 24 hours | publisher=SAMS Publishing | year=1999 | pages=40 | isbn=978-0672314537 | first=Thane | last=Hubbell | lccn=98087215}} 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.{{sfn|McCracken|Golden|1988|loc=§ 19.9}}

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, {{code|property-name}} and {{code|sales-region}}, 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 {{dfn|condition name}} (a so-called 88-level) which is true when its parent data item contains one of the values specified in its {{code|VALUE}} clause.{{sfn|Cutler|2014|loc=§ 5.8.5}} 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 {{code|wage-type}} data item. When the data item contains a value of {{code|'H'}}, the condition-name {{code|wage-is-hourly}} is true, whereas when it contains a value of {{code|'S'}} or {{code|'Y'}}, the condition-name {{code|wage-is-yearly}} 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:{{sfn|ISO/IEC JTC 1/SC 22/WG 4|2014|loc=§ 8.5.2}}

class="wikitable"
Data type

! Sample declaration

! Notes

Alphabetic

| {{code|PIC A(30)|lang=cobolfree}}

| May contain only letters or spaces.

Alphanumeric

| {{code|PIC X(30)|lang=cobolfree}}

| May contain any characters.

Boolean

| {{code|PIC 1 USAGE BIT|lang=cobolfree}}

| Data stored in the form of 0s and 1s, as a binary number.

Index

| {{code|USAGE INDEX|lang=cobolfree}}

| Used to reference table elements.

National

| {{code|PIC N(30)|lang=cobolfree}}

| Similar to alphanumeric, but using an extended character set, e.g. UTF-8.

Numeric

| {{code|PIC 9(5)V9(2)|lang=cobolfree}}

| Contains exactly 7 digits (7=5+2). 'V' locates the implicit decimal in a fixed point number.

Object

| {{code|USAGE OBJECT REFERENCE|lang=cobolfree}}

| May reference either an object or NULL.

Pointer

| {{code|USAGE POINTER|lang=cobolfree}}

|

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.{{sfn|ISO/IEC JTC 1/SC 22/WG 4|2014|loc=§ 14.9.24}} 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.{{sfn|ISO/IEC JTC 1/SC 22/WG 4|2014|loc=§ 14.9.35}}

===PICTURE clause===

A {{code|PICTURE}} (or {{code|PIC}}) 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 {{code|9}} indicates a decimal digit, and an {{code|S}} indicates that the item is signed. Other picture characters (called {{dfn|insertion}} and {{dfn|editing}} characters) specify how an item should be formatted. For example, a series of {{code|+}} 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 {{code|+}} 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, {{code|9(7)}} is equivalent to {{code|9999999}}. Picture specifications containing only digit ({{code|9}}) and sign ({{code|S}}) characters define purely {{dfn|numeric}} data items, while picture specifications containing alphabetic ({{code|A}}) or alphanumeric ({{code|X}}) characters define {{dfn|alphanumeric}} data items. The presence of other formatting characters define {{dfn|edited numeric}} or {{dfn|edited alphanumeric}} data items.{{sfn|ISO/IEC JTC 1/SC 22/WG 4|2014|loc=§ 13.18.40}}

class="wikitable"

|+ Examples

{{code|PICTURE}} clause

! Value in

! Value out

rowspan="2" | {{code|PIC 9(5)|lang=cobolfree}}

| {{code|100}}

| {{code|00100}}

{{code|"Hello"}}

| {{code|"Hello"}} (this is legal, but results in undefined behavior){{sfn|ISO/IEC JTC 1/SC 22/WG 4|2014|loc=§ 14.9.24}}

{{code|PIC +++++|lang=cobolfree}}

| {{code

10}}

| "  -10" (note leading spaces)

{{code|PIC 99/99/9(4)|lang=cobolfree}}

| {{code|30042003}}

| {{code|"30/04/2003"}}

rowspan="2" | {{code|PIC *(4)9.99|lang=cobolfree}}

| {{code|100.50}}

| {{code|"**100.50"}}

0

| {{code|"****0.00"}}

{{code|PIC X(3)BX(3)BX(3)|lang=cobolfree}}

| {{code|"ABCDEFGHI"}}

| {{code|"ABC DEF GHI"}}

===USAGE clause===

{{missing information|section|COMPUTATIONAL-5|date=April 2021}}

The {{code|USAGE}} clause declares the format in which data is stored. Depending on the data type, it can either complement or be used instead of a {{code|PICTURE}} clause. While it can be used to declare pointers and object references, it is mostly geared towards specifying numeric types. These numeric formats are:{{sfn|ISO/IEC JTC 1/SC 22/WG 4|2014|loc=§ 13.18.60.3}}

  • Binary, where a minimum size is either specified by the PICTURE clause or by a USAGE clause such as BINARY-LONG
  • {{code|USAGE COMPUTATIONAL|lang=cobolfree}}, where data may be stored in whatever format the implementation provides; often equivalent to  {{code|USAGE BINARY|lang=cobolfree}}
  • {{code|USAGE DISPLAY|lang=cobolfree}}, the default format, where data is stored as a string
  • Floating-point, in either an implementation-dependent format or according to IEEE 754
  • {{code|USAGE NATIONAL|lang=cobolfree}}, where data is stored as a string using an extended character set
  • {{code|USAGE PACKED-DECIMAL|lang=cobolfree}}, 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.{{sfn|ISO/IEC JTC 1/SC 22/WG 4|2014|p=855}}

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 {{dfn|control breaks}}. 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 12052014FOOFOO

Sales on 30/05/2014 were $0.00

Four statements control the report writer: {{code|INITIATE}}, which prepares the report writer for printing; {{code|GENERATE}}, which prints a report group; {{code|SUPPRESS}}, which suppresses the printing of a report group; and {{code|TERMINATE}}, 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 tends to vary considerably; some organizations use it extensively and some not at all.{{sfn|McCracken|1976|p=338}} In addition, implementations of Report Writer ranged in quality, with those at the lower end sometimes using excessive amounts of memory at runtime.{{sfn|McCracken|1976|p=338}}

=Procedure division=

==Procedures==

The sections and paragraphs in the procedure division (collectively called procedures) can be used as labels and as simple subroutines. Unlike in other divisions, paragraphs do not need to be in sections.{{sfn|ISO/IEC JTC 1/SC 22/WG 4|2014|loc=§ 14.4}}

Execution goes down through the procedures of a program until it is terminated.{{sfn|ISO/IEC JTC 1/SC 22/WG 4|2014|loc=§ 14.6.3}}

To use procedures as subroutines, the {{code|PERFORM}} verb is used.

A {{code|PERFORM}} statement somewhat resembles a procedure call in a newer languages in the sense that execution returns to the code following the {{code|PERFORM}} statement at the end of the called code; however, it does not provide a mechanism for parameter passing or for returning a result value. If a subroutine is invoked using a simple statement like {{code|PERFORM subroutine|lang=cobolfree}}, then control returns at the end of the called procedure. However, {{code|PERFORM}} is unusual in that it may be used to call a range spanning a sequence of several adjacent procedures. This is done with the {{code|PERFORM sub-1 THRU sub-n|lang=cobolfree}} 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".

{{code|PERFORM}} 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 {{code|PERFORM}}'ed may execute a {{code|PERFORM}} 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 {{code|PERFORM}} invocation that was called earlier but has not yet completed, the COBOL 2002 standard stipulates that the behavior is 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 {{code|PERFORM}} statements happen, control flows from top to bottom through the program. But when a {{code|PERFORM}} statement executes, it modifies the continuation address of the called procedure (or the last procedure of the called range, if {{code|PERFORM THRU}} 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.{{cite conference | url=http://pages.cs.wisc.edu/~ramali/Papers/paste99.pdf |archive-url=https://web.archive.org/web/20101224060615/http://pages.cs.wisc.edu/~ramali/Papers/paste99.pdf |archive-date=24 December 2010 |url-status=live | title=Identifying Procedural Structure in Cobol Programs | doi=10.1145/381788.316163 | first1=John | last1=Field | first2=G. | last2=Ramalingam | conference=PASTE '99 | isbn=1581131372 | conference-url=http://cseweb.ucsd.edu/~wgg/paste99.html | date=September 1999}}{{cite journal | url=http://www.cs.vu.nl/~nveerman/research/minefield/minefield.pdf | title=Cobol minefield detection | journal=Software: Practice and Experience |date=November 2006 | volume=36 | issue=14 | doi=10.1002/spe.v36:14 | archive-url=https://web.archive.org/web/20070306135410/http://www.cs.vu.nl/~nveerman/research/minefield/minefield.pdf | url-status=dead | archive-date=6 March 2007 | last1=Veerman | first1=Niels | last2=Verhoeven | first2=Ernst-Jan | s2cid=18619757 }}

The following example (taken from {{harvnb|Veerman|Verhoeven|2006}}) 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 {{code|PERFORM}} 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 {{code|PERFORM}} statement sets the continuation address at the end of {{code|LABEL3}} so that it will jump back to the call site inside {{code|LABEL1}}. The second {{code|PERFORM}} statement sets the return at the end of {{code|LABEL4}} but does not modify the continuation address of {{code|LABEL3}}, expecting it to be the default continuation. Thus, when the inner invocation arrives at the end of {{code|LABEL3}}, it jumps back to the outer {{code|PERFORM}} 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 {{code|PERFORM}} 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 {{code|PERFORM}} cannot be used to write recursive code. Another simple example to illustrate this (slightly simplified from {{harvnb|Veerman|Verhoeven|2006}}):

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 other 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 {{code|DISPLAY 'END'}}.

==Statements==

COBOL 2014 has 47 statements (also called {{dfn|verbs}}),{{sfn|ISO/IEC JTC 1/SC 22/WG 4|2014|loc=§ 14.9}} 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 {{code|IF}} and {{code|EVALUATE}}. {{code|EVALUATE}} is a switch-like statement with the added capability of evaluating multiple values and conditions. This can be used to implement decision tables. For example, the following might be used to control a CNC lathe:

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 {{code|PERFORM}} statement is used to define loops which are executed {{em|until}} a condition is true (not {{em|while}} 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). {{code|CALL}} and {{code|INVOKE}} 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.{{sfn|ISO/IEC JTC 1/SC 22/WG 4|2014|loc=§§ 14.9.4, 14.9.22}} Parameters can be passed by reference, by content (where a copy is passed by reference) or by value (but only if a prototype is available).{{sfn|ISO/IEC JTC 1/SC 22/WG 4|2014|loc=§ D.6.5.2.2}}

{{code|CANCEL}} unloads subprograms from memory. {{code|GO TO}} causes the program to jump to a specified procedure.

The {{code|GOBACK}} statement is a return statement and the {{code|STOP}} statement stops the program. The {{code|EXIT}} statement has six different formats: it can be used as a return statement, a break statement, a continue statement, an end marker or to leave a procedure.{{sfn|ISO/IEC JTC 1/SC 22/WG 4|2014|loc=§ 14.9.13.1}}

Exceptions are raised by a {{code|RAISE}} statement and caught with a handler, or {{dfn|declarative}}, defined in the {{code|DECLARATIVES}} portion of the procedure division. Declaratives are sections beginning with a {{code|USE}} statement which specify the errors to handle. Exceptions can be names or objects. {{code|RESUME}} is used in a declarative to jump to the statement after the one that raised the exception or to a procedure outside the {{code|DECLARATIVES}}. 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 {{code|OPEN}}, {{code|CLOSE}}, {{code|READ}}, and {{code|WRITE}} statements along with a further three: {{code|REWRITE}}, which updates a record; {{code|START}}, which selects subsequent records to access by finding a record with a certain key; and {{code|UNLOCK}}, which releases a lock on the last record accessed.

User interaction is done using {{code|ACCEPT}} and {{code|DISPLAY}}.

===Data manipulation===

The following verbs manipulate data:

  • {{code|INITIALIZE}}, which sets data items to their default values.
  • {{code|MOVE}}, which assigns values to data items ; MOVE CORRESPONDING assigns corresponding like-named fields.
  • {{code|SET}}, which has 15 formats: it can modify indices, assign object references and alter table capacities, among other functions.{{sfn|ISO/IEC JTC 1/SC 22/WG 4|2014|loc=§14.9.35.1}}
  • {{code|ADD}}, {{code|SUBTRACT}}, {{code|MULTIPLY}}, {{code|DIVIDE}}, and {{code|COMPUTE}}, which handle arithmetic (with {{code|COMPUTE}} assigning the result of a formula to a variable).
  • {{code|ALLOCATE}} and {{code|FREE}}, which handle dynamic memory.
  • {{code|VALIDATE}}, which validates and distributes data as specified in an item's description in the data division.
  • {{code|STRING}} and {{code|UNSTRING}}, which concatenate and split strings, respectively.
  • {{code|INSPECT}}, which tallies or replaces instances of specified substrings within a string.
  • {{code|SEARCH}}, which searches a table for the first entry satisfying a condition.

Files and tables are sorted using {{code|SORT}} and the {{code|MERGE}} verb merges and sorts files. The {{code|RELEASE}} verb provides records to sort and {{code|RETURN}} retrieves sorted records in order.

==Scope termination==

Some statements, such as {{code|IF}} and {{code|READ}}, may themselves contain statements. Such statements may be terminated in two ways: by a period ({{dfn|implicit termination}}), 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.{{sfn|ISO/IEC JTC 1/SC 22/WG 4|2014|p=899}}{{sfn|McCracken|Golden|1988|loc=§ 8.4}} 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 {{code|DISPLAY y|lang=cobolfree}}.

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  {{code|IF y|lang=cobolfree}}  statement instead of the  {{code|IF x|lang=cobolfree}}  statement, causing a bug. Prior to the introduction of explicit scope terminators, preventing it would require  {{code|ELSE NEXT SENTENCE|lang=cobolfree}}  to be placed after the inner IF.{{sfn|McCracken|Golden|1988|loc=§ 8.4}}

==Self-modifying code==

The original (1959) COBOL specification supported the infamous  {{code|ALTER X TO PROCEED TO Y|lang=cobolfree}}  statement, for which many compilers generated self-modifying code. X and Y are procedure labels, and the single  {{code|GO TO|lang=cobolfree}}  statement in procedure X executed after such an {{code|ALTER}} statement means  {{code|GO TO Y|lang=cobolfree}}  instead. Many compilers still support it,Examples of compiler support for {{code|ALTER}} can be seen in the following:

  • {{cite web|ref=none

|last=Tiffin

|first=Brian

|title=September 2013

|url=http://sourceforge.net/p/open-cobol/discussion/cobol/thread/7dc2941f/#5ee9

|work=GNU Cobol

|date=18 September 2013

|access-date=5 January 2014

|archive-url=https://web.archive.org/web/20140505181734/http://sourceforge.net/p/open-cobol/discussion/cobol/thread/7dc2941f/

|archive-date=5 May 2014

|url-status=dead

}}

  • {{cite web|ref=none

|url=http://documentation.microfocus.com/help/topic/com.microfocus.eclipse.infocenter.visualcobol.vs2013/HRLHLHPDF803.html

|title=The ALTER Statement

|publisher=Micro Focus

|work=Micro Focus Visual COBOL 2.2 for Visual Studio 2013 COBOL Language Reference

|access-date=5 January 2014

}}

  • {{cite web|ref=none

|url=http://www.csim.scu.edu.tw/~kuo/COBOL/COBOLCompiler/COBOL%E6%89%8B%E5%86%8A/cob_lrf.pdf

|title=ALTER Statement (Nucleus)

|publisher=Fujitsu

|work=COBOL85 Reference Manual

|date=November 1996

|access-date=5 January 2014

|page=555

|archive-url=https://web.archive.org/web/20140106031540/http://www.csim.scu.edu.tw/~kuo/COBOL/COBOLCompiler/COBOL%E6%89%8B%E5%86%8A/cob_lrf.pdf

|archive-date=6 January 2014

|url-status=dead

}}

  • {{cite web|ref=none

|url=http://pic.dhe.ibm.com/infocenter/pdthelp/v1r1/topic/com.ibm.entcobol.doc_5.1/PGandLR/ref/rlpsalte.html

|title=ALTER Statement

|publisher=IBM

|work=Enterprise COBOL for z/OS Language Reference

|date=June 2013

|access-date=5 January 2014

}} but it was deemed obsolete in the COBOL 1985 standard and deleted in 2002.{{sfn|ISO/IEC JTC 1/SC 22/WG 4|2001|loc=§ F.1}}

The {{code|ALTER}} statement was poorly regarded because it undermined "locality of context" and made a program's overall logic difficult to comprehend.{{sfn|McCracken|1976|p=355}} 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."{{sfn|McCracken|1976|p=355}}

=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 example in The C Programming Language 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 running MVS 3.8J. The JCL, written in July 2015, is derived from the Hercules tutorials and samples hosted by Jay Moseley.{{cite web | url=http://www.jaymoseley.com/hercules/compilers/cobol.htm | title=COBOL Compiler from MVT | date=17 January 2015 | access-date=19 July 2015 | first=Jay | last=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 paradigm was becoming increasingly widespread. Edsger Dijkstra, a preeminent computer scientist, wrote a letter to the editor of Communications of the ACM, published in 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".{{cite web |url=http://www.cs.utexas.edu/users/EWD/transcriptions/EWD04xx/EWD498.html |title=How do we tell truths that might hurt? |access-date=29 August 2007 |publisher=University of Texas at Austin |date=18 June 1975 |last=Dijkstra |first=Edsger W. |id=EWD498 |archive-url= https://web.archive.org/web/20170502143353/http://www.cs.utexas.edu/users/EWD/transcriptions/EWD04xx/EWD498.html |archive-date=2 May 2017 |url-status=dead}}

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.{{Cite journal |doi= 10.1145/948176.948186| title=In defense of teaching structured COBOL as computer science| journal=ACM SIGPLAN Notices| volume=18| issue=4| pages=86–94| year=1983| last1=Tompkins| first1=H. E.| s2cid=33803213| doi-access=free}}

One cause of spaghetti code was the {{code|GO TO}} statement. Attempts to remove {{code|GO TO}}s from COBOL code, however, resulted in convoluted programs and reduced code quality.{{sfn|Riehle|1992|p=125}} {{code|GO TO}}s were largely replaced by the {{code|PERFORM}} statement and procedures, which promoted modular programming{{sfn|Riehle|1992|p=125}} and gave easy access to powerful looping facilities. However, {{code|PERFORM}} could be used only with procedures so loop bodies were not located where they were used, making programs harder to understand.{{sfn|Shneiderman|1985|pp=349–350}}

COBOL programs were infamous for being monolithic and lacking modularization.{{cite book | url=https://books.google.com/books?id=MJmJAwAAQBAJ&pg=PA4 | title=Beginning COBOL for Programmers | publisher=Apress | access-date=13 August 2014 | page=4 | first=Michael | last=Coughlan | isbn=978-1430262534 | date=16 March 2014}}

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 {{em|any}} data item. Furthermore, there was no way to pass parameters to a procedure, an omission Jean Sammet regarded as the committee's biggest mistake.{{sfn|Sammet|1978b|p=258}}

Another complication stemmed from the ability to {{code|PERFORM THRU}} 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.{{sfn|Riehle|1992|p=126}}

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.{{sfn|Riehle|1992|p=127}} 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 practically 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.{{Cite web|url=http://www.nakedcapitalism.com/2016/07/cobol-and-legacy-code-as-a-systemic-risk.html?imm_mid=0e6043&cmp=em-prog-na-na-newsltr_20160723|title=COBOL and Legacy Code as a Systemic Risk {{!}} naked capitalism|date=19 July 2016|language=en-US|access-date=23 July 2016}}

=Compatibility issues=

COBOL was intended to be a highly portable, "common" language. However, by 2001, around 300 dialects had been created.{{cite journal | url=http://www.cs.vu.nl/grammarware/500/500.pdf | title=Cracking the 500-language problem | journal=IEEE Software |date=November–December 2001 | volume=18 | issue=6 | page=79 | doi=10.1109/52.965809 | first1=Ralf | last1=Lämmel | first2=Chris | last2=Verhoef | hdl=1871/9853 | author-link2 = Chris Verhoef| archive-url=https://web.archive.org/web/20140819085841/http://www.cs.vu.nl/grammarware/500/500.pdf | archive-date=19 August 2014 | url-status=dead}} 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 possible variants.{{cite journal | title=Towards more portable COBOL | journal=The Computer Journal | date=April 1979 | volume=22 | issue=4 | pages=290 | doi=10.1093/comjnl/22.4.290 | first1=T. J. | last1=Howkins | first2=M. T. | last2=Harandi | doi-access=free }}

COBOL-85 was not fully compatible with earlier versions, and its development was controversial. Joseph T. Brophy, the CIO of Travelers Insurance, spearheaded an effort to inform COBOL users of the heavy reprogramming costs of implementing the new standard.{{sfn|Garfunkel|1987|p=11}} 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.{{sfn|Garfunkel|1987|p=15}}

=Verbose syntax=

{{quote box

| title=COBOL: /koh′bol/, n.

| tstyle=text-align: left;

| quote=A weak, verbose, and flabby language used by code grinders to do boring mindless things on dinosaur mainframes. [...] Its very name is seldom uttered without ritual expressions of disgust or horror.

| source=The Jargon File 4.4.8.{{cite web | url=http://catb.org/jargon/html/C/COBOL.html | title=COBOL | work=The Jargon File, version 4.4.8 | date=1 October 2004 | access-date=13 December 2014 | first=Eric S. | last=Raymond | author-link=Eric S. Raymond | url-status=live | archive-url=https://web.archive.org/web/20140830184553/http://www.catb.org/jargon/html/C/COBOL.html | archive-date=30 August 2014}}

| align=right

| width=30%

| quoted=1

}}

COBOL syntax has often been criticized for its verbosity. Proponents say that this was intended to make the code self-documenting, easing program maintenance.{{sfn|Brown|1976|p=53}} COBOL was also intended to be easy for programmers to learn and use,{{sfn|CODASYL|1969|loc=§ II.1.1}} while still being readable to non-technical staff such as managers.{{sfn|Shneiderman|1985|p=350}}{{sfn|Sammet|1961|p=381}}{{sfn|Conner|1984|p=ID/10}}{{sfn|Marcotty|1978a|p=263}}

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{{sfn|Conner|1984|p=ID/10}} 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.{{sfn|Conner|1984|p=ID/14}}

{{quote box

| title=

| tstyle=text-align: left;

| quote=The academic world tends to regard COBOL as verbose, clumsy and inelegant, and tries to ignore it, although there are probably more COBOL programs and programmers in the world than there are for FORTRAN, ALGOL and PL/I combined. For the most part, only schools with an immediate vocational objective provide instruction in COBOL.

| source=Richard Conway and David Gries, 1973{{cite book |last1=Conway |first1=Richard |last2=Gries |first2=David |year=1973 |title=An Introduction to Programming: A Structured Approach using PL/1 and PL/C |publisher=Winthrop Publishers |location=Cambridge, Massachusetts | page=341 | isbn=0-87626-405-4 }}

| align=left

| width=30%

| quoted=1

}}

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).{{Cite web |url=https://books.bibliopolis.com/main/find/2200821/COBOL-Logic-and-Programming-third-edition-1974-McCameron-Fritz-oldcomputerbooks-com.html |title=COBOL Logic and Programming, third edition 1974 |access-date=25 February 2016 |archive-url=https://web.archive.org/web/20160305083547/https://books.bibliopolis.com/main/find/2200821/COBOL-Logic-and-Programming-third-edition-1974-McCameron-Fritz-oldcomputerbooks-com.html |archive-date=5 March 2016 |url-status=dead }} 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".{{cite journal| url=https://books.google.com/books?id=VQhbdDusHcsC&pg=RA1-PA61 | title=An interview: Cobol defender | journal=Computerworld | date=10 September 1984 | access-date=8 June 2014 | author= | pages=ID/29–ID/32 | volume=18 | issue=37}}

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, implying that COBOL could be used only for non-challenging problems.{{cite book |last1=Pratt |first1=Terrence W. |last2=Zelkowitz |author2-link=Marvin Victor Zelkowitz|first2=Marvin V. |date=1984 |edition=2nd |title=Programming Languages: Design and Implementation |publisher=Englewood Cliffs, N.J. : Prentice Hall |isbn=0136780121}}

In 2003, COBOL featured in 80% of information systems curricula in the United States, the same proportion as C++ and Java.{{sfn|Carr|Kizior|2003|p=13}} Ten years later, a poll by Micro Focus 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.{{cite press release | url=http://www.microfocus.com/about/press/pressreleases/2013/pr070320131001.aspx | title=Academia needs more support to tackle the IT skills gap | publisher=Micro Focus | date=7 March 2013 | access-date=4 August 2014}}

=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."{{sfn|Beyer|2009|p=301}} 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.{{cite journal | title=Summary of Changes in COBOL, 1960–1985 | journal=Annals of the History of Computing | date=October 1985 | volume=7 | issue=4 | pages=342 | first1=Jean | last1=Sammet | first2=Jerome | last2=Garfunkel | doi=10.1109/MAHC.1985.10033 | s2cid=17940092 }}

COBOL standards have repeatedly suffered from delays: COBOL-85 arrived five years later than hoped,{{cite conference | url=http://www.computer.org/csdl/proceedings/afips/1978/5086/00/50861107.pdf | title=Data Base Facility for COBOL 80 | first=Margaret M. | last=Cook | conference=1978 National Computer Conference | quote=The earliest date that a new COBOL standard could be developed and approved is the year 1980 [...]. | pages=1107–1112 | publisher=AFIPS Press | date=June 1978 | location=Anaheim, California | lccn= 55-44701 | doi=10.1109/AFIPS.1978.63 | access-date=2 September 2014 | editor1-last=Ghosh | editor1-first=Sakti P. | editor2-last=Liu | editor2-first=Leonard Y.}} COBOL 2002 was five years late, and COBOL 2014 was six years late.{{cite web | url=http://www.cobolstandard.info/wg4/open/wg4n0188.doc | title=Resolutions from WG4 meeting 24 – June 26–28, 2003 Las Vegas, Nevada, USA | date=11 July 2003 | access-date=29 June 2014 | format=doc | quote=a June 2008 revision of the COBOL standard | page=1 | url-status=dead | archive-url=https://web.archive.org/web/20160308015945/http://www.cobolstandard.info/wg4/open/wg4n0188.doc | archive-date=8 March 2016}} 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.{{cite journal | url=https://books.google.com/books?id=tQOdtdJmVSsC&pg=PA12 | title=Cobol standard add-ons flayed | journal=Computerworld | volume=20 | issue=28 | pages=1, 12 | first=Charles | last=Babcock | date=14 July 1986}}

=Influences on other languages=

COBOL's data structures influenced subsequent programming languages. Its record and file structure influenced PL/I and Pascal, and the REDEFINES clause was a predecessor to Pascal's variant records. Explicit file structure definitions preceded the development of database management systems and aggregated data was a significant advance over Fortran's arrays.{{sfn|Shneiderman|1985|p=349}}

PICTURE data declarations were incorporated into PL/I, with minor changes.

COBOL's {{code|COPY}} facility, although considered "primitive",{{sfn|Marcotty|1978b|p=274}} influenced the development of include directives.{{sfn|Shneiderman|1985|p=349}}

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:

  • {{cite web|ref=none | url=http://www-304.ibm.com/partnerworld/gsd/solutiondetails.do?solution=48040&expand=true&lc=en | title=Visual COBOL | publisher=IBM | work=IBM PartnerWorld | date=21 August 2013 | access-date=5 February 2014 | quote=Micro Focus Visual COBOL delivers the next generation of COBOL development and deployment for Linux x86-64, Linux for System z, AIX, HP/UX, Solaris, and Windows. | archive-url=https://web.archive.org/web/20140712183624/http://www-304.ibm.com/partnerworld/gsd/solutiondetails.do?solution=48040 | archive-date=12 July 2014 | url-status=live}}
  • {{cite web|ref=none | url=https://www.ibm.com/products/cobol-compiler-family | title=IBM COBOL Compiler Family | date=16 May 2024 | publisher=IBM | access-date=11 September 2024}}
  • {{cite web|ref=none | url=https://gnucobol.sourceforge.io | title=GnuCOBOL - GNU Project | access-date=11 September 2024}}

Additionally, the well-defined division structure restricts the definition of external references to the Environment Division, which simplifies platform changes in particular.{{cite web | url=http://www.csis.ul.ie/cobol/course/COBOLIntro.htm#part1 | title=Introduction to COBOL | year=2002 | archive-date=5 March 2023 | archive-url=https://web.archive.org/web/20230305155004/https://www.csis.ul.ie/cobol/course/COBOLIntro.htm | last=Coughlan |first=Michael}}

See also

{{Portal|Computer programming}}

Notes

{{notelist|refs=

{{efn|name=Gartner ubiquity|The reader should be cautioned that although the 1997 Gartner Group study is referenced ubiquitously with a famous "200 billion lines of COBOL" quote, the actual report is difficult to find.{{cite web |url=https://1997-2001.state.gov/dept/irm/y2k/gartner.html |title=Gartner Group Studies |author= |date=2000 |website=1997-2001.state.gov |publisher=Year 2000 Program Management Office |access-date=23 April 2022}} Moreover, some speculate{{cite web |url=https://www.cobsolete.de/2021/04/08/cobol-fact-check/#%E2%80%9EThere_are_150_to_300_billion_lines_of_COBOL_code_and_%E2%80%9E5_billion_lines_of_COBOL_code_are_newly_written_each_year |title=COBOL Fact-Check |last=Engelmann |first=Viktor |date=8 April 2021 |website=cobsolete.de |publisher=COBSOLETE |access-date=23 April 2022}} that "the only involvement of Gartner in these numbers" was the 1995 study{{cite magazine |author= |magazine=CIO |page=82 |date=15 December 1995 - 1 January 1996 |title=What Will the Future Hold |publisher=International Data Group}} which "projected that fixing the Y2K bug would cost $1 per line or $300 billion total," which caused the misinterpretation of the report.}}

}}

References

=Citations=

{{Reflist|30em}}

=Sources=

{{refbegin|2}}

  • {{cite journal

| url=http://archive.computerhistory.org/resources/text/Knuth_Don_X4100/PDF_index/k-8-pdf/k-8-u2776-Honeywell-mag-History-Cobol.pdf

| title=A View of the History of COBOL

| journal=Honeywell Computer Journal

| access-date=28 June 2014

| volume=5

| issue=3

| date=1971

| first=Bob

| last=Bemer

| author-link=Bob Bemer

| archive-url=https://web.archive.org/web/20160122164500/http://archive.computerhistory.org/resources/text/Knuth_Don_X4100/PDF_index/k-8-pdf/k-8-u2776-Honeywell-mag-History-Cobol.pdf

| archive-date=22 January 2016

| url-status=dead

}}

  • {{cite book

| url=https://books.google.com/books?id=u5KKwGjulEwC&pg=PA282

| title=Grace Hopper and the Invention of the Information Age

| publisher=MIT Press

| year=2009

| isbn=978-0262013109

| first=Kurt

| last=Beyer

| lccn=2008044229

}}

  • {{cite book

| url=https://books.google.com/books?id=G6a2tSuOoq8C&pg=PA47

| title=Encyclopedia of Computer Science and Technology: Volume 5

| publisher=CRC Press

| isbn=978-0824722555

| date=1 December 1976

| section=COBOL

| first=William R.

| last=Brown

| editor1-first=Jack

| editor1-last=Belzer

| editor2-first=Albert G.

| editor2-last=Holzman

| editor3-first=Allen

| editor3-last=Kent

}}

  • {{cite journal

| url=http://www.isedj.org/1/52/ISEDJ.1(52).Carr.pdf

| url-status=live

| title=Continued Relevance of COBOL in Business and Academia: Current Situation and Comparison to the Year 2000 Study

| archive-url=https://web.archive.org/web/20230305160148/https://www.isedj.org/1/52/ISEDJ.1(52).Carr.pdf

| archive-date=5 March 2023

| date=31 December 2003

| access-date=4 August 2014

| last1=Carr

| first1=Donald E.

| last2=Kizior

| first2=Ronald J.

| journal=Information Systems Education Journal

| volume=1

| issue=52

| issn=1545-679X

| s2cid=62485945

}}

  • {{cite book

| url=https://archive.org/details/codasylcoboljour00conf

| title=CODASYL COBOL Journal of Development 1968 |date=July 1969

| lccn=73601243

| author=CODASYL

| author-link=CODASYL

| publisher=National Bureau of Standards

| issn=0591-0218

| ol=OL14204153M

}}

  • {{cite journal

| url=https://books.google.com/books?id=BrEo9KtAQH4C&pg=RA1-PA61

| title=Cobol, your age is showing

| journal=Computerworld

| volume=18

| issue=20

| pages=ID/7–ID/18

| first=Richard L.

| last=Conner

| date=14 May 1984

| issn=0010-4841

}}

  • {{cite book

| url=http://opencobol.add1tocobol.com/guides/GNU%20COBOL%202.1%2023NOV2013%20Programmers%20Guide%20(US%20Letter).pdf

| title=GNU COBOL Programmer's Guide

| date=9 April 2014

| access-date=25 February 2014

| last=Cutler

| first=Gary

| edition=3rd

}}

  • {{cite book

| title=The COBOL 85 Example Book

| first=Jerome

| last=Garfunkel

| publisher=Wiley

| year=1987

| isbn=978-0471804611

}}

  • {{cite web

| url=http://www.ncits.org/tc_home/j4htm/cobolv200112.zip

| title=ISO/IEC IS 1989:2001 – Programming language COBOL

| author=((ISO/IEC JTC 1/SC 22/WG 4))

| publisher=ISO

| date=4 December 2001

| access-date=2 September 2014

| archive-url=https://web.archive.org/web/20020124065139/http://www.ncits.org/tc_home/j4htm/cobolv200112.zip

| archive-date=24 January 2002

| url-status=dead

| format=ZIP of PDF

}} (Link goes to draft N 0147)

  • {{cite book

| title=INCITS/ISO/IEC 1989:2014 [2014] – Programming language COBOL

| author=ISO/IEC JTC 1/SC 22/WG 4

| publisher=INCITS

| date=31 October 2014

}}

  • {{cite book

| title=ISO/IEC 1989:2023 – Programming language COBOL

| author=ISO/IEC JTC 1/SC 22/WG 4

| publisher=ISO

| date=January 2023

| url=https://www.iso.org/standard/74527.html

| url-access=subscription

}}

  • {{cite web

| url=http://home.comcast.net/~wmklein/DOX/History.pdf

| title=The History of COBOL

| date=4 October 2010

| access-date=7 January 2014

| last=Klein

| first=William M.

| archive-url=https://web.archive.org/web/20140107192608/http://home.comcast.net/~wmklein/DOX/History.pdf

| archive-date=7 January 2014

| url-status=dead

}}

  • {{cite conference

| first=Michael

| last=Marcotty

| page=263

| title=Transcript of question and answer session

| editor1-last=Wexelblat

| editor1-first=Richard L.

| conference=History of Programming Languages

| year=1978a

| publisher=Academic Press

| publication-date=1981

| isbn=0127450408

| doi=10.1145/800025.1198370 | doi-access=free

| url=https://archive.org/details/historyofprogram0000hist/page/263

}}

  • {{cite conference

| first=Michael | last=Marcotty

| title=Full text of all questions submitted

| editor1-last=Wexelblat | editor1-first=Richard L.

| conference=History of Programming Languages

| year=1978b

| publisher=Academic Press

| publication-date=1981

| isbn=0127450408

| doi=10.1145/800025.1198371 | doi-access=free

| page=274

| url=https://archive.org/details/historyofprogram0000hist/page/274

}}

  • {{cite book

| title=A Simplified Guide to Structured COBOL Programming

| publisher=Wiley

| year=1976

| isbn=0-471-58284-0

| lccn=75044399

| first=Daniel D.

| last=McCracken

| author-link=Daniel D. McCracken

| url-access=registration

| url=https://archive.org/details/simplifiedguidet0000mccr

}}

  • {{cite book

| title=A Simplified Guide to Structured COBOL Programming

| publisher=Wiley

| year=1988

| isbn=978-0471610540

| first1=Daniel D.

| last1=McCracken

| first2=Donald G.

| last2=Golden

| edition=2nd

| lccn=87034608

}}

  • {{cite journal

| title=PERFORM considered harmful

| journal=Communications of the ACM

| date=August 1992

| doi=10.1145/135226.376106 | doi-access=free

| volume=35

| issue=8

| pages=125–128

| first=Richard L.

| last=Riehle

| s2cid=18845698

}}

  • {{Cite conference

| title=A method of combining ALGOL and COBOL

| first=Jean E.

| last=Sammet

| author-link=Jean E. Sammet

| date=May 1961

| conference=Papers presented at the 9–11 May 1961, western joint IRE–AIEE–ACM computer conference

| doi=10.1145/1460690.1460734 | doi-access=free

| pages=379–387

| publisher=ACM

}}

  • {{cite conference

| first=Jean E.

| last=Sammet

| title=The early history of COBOL

| editor1-last=Wexelblat

| editor1-first=Richard L.

| conference=History of Programming Languages

| year=1978a

| publisher=Academic Press

| publication-date=1981

| isbn=0127450408

| doi=10.1145/800025.1198367

| url-access=registration

| url=https://archive.org/details/historyofprogram0000hist

}}

  • {{cite conference

| first=Jean E.

| last=Sammet

| title=Transcript of presentation

| editor1-last=Wexelblat

| editor1-first=Richard L.

| conference=History of Programming Languages

| year=1978b

| publisher=Academic Press

| publication-date=1981

| isbn=0127450408

| doi=10.1145/800025.1198368

| url-access=registration

| url=https://archive.org/details/historyofprogram0000hist

}}

  • {{cite book

| url=https://books.google.com/books?id=5Jaa1BVverIC&pg=PA104

| title=Concise Encyclopedia of Computer Science

| publisher=Wiley

| first=Jean E.

| last=Sammet

| oclc=249810423

| isbn=978-0470090954

| editor-first=Edwin D.

| editor-last=Reilly

| date=23 July 2004

| section=COBOL

}}

  • {{cite journal

| title=The Relationship Between COBOL and Computer Science

| journal=Annals of the History of Computing |date=October 1985

| volume=7

| issue=4

| pages=348–352

| first=B.

| last=Shneiderman

| doi=10.1109/MAHC.1985.10041

| s2cid=1009406

}}

{{refend}}