Last updated: September 30, 2020
COBOL Programming: No Punch Cards Needed
Disclosure: Your support helps keep the site running! We earn a referral fee for some of the services we recommend on this page. Learn more
COBOL, or COmmon Business Oriented Language, is a legacy computer programming language designed for business computing. It debuted in the late 1950s, and was in heavy use in a number of industries for the next several decades.
A large amount of software originally built in COBOL between the 1960s and 1990s is still running, often powering mission-critical systems which average people interact with every day, such as banking systems, payment processing, insurance underwriting, and traffic control.
COBOL is one of the oldest programming languages still in common use, second perhaps only to FORTRAN, which is a few years older. (There seems to be a lot more COBOL still running in the world than there is FORTRAN, though.)
History of COBOL
In the 1950s, computers began their rise to prominence in the business sector. But as the cost of these new machines began to creep downward, the cost of actually programming them was rising.
Moreover, with each new generation of hardware, software programs often had to be nearly completely rewritten to work on the updated machines — the cost of translating programs to work on new systems was around 3/4 of the cost of developing the software in the first place.
Concerned over these costs, a group of business leaders, along with academics and computer manufacturers, met in 1959 to discuss solutions to this problem. They asked the Department of Defense (which was funding a great deal of computer-related research and development) to sponsor the development of a new programming language.
This new language would be portable from machine to machine, and would be suited to the data-processing tasks needed in large businesses. (Fortran was limited in its portability at that time, and was moreover unsuited to the types of tasks most needed by business and industry.)
Since this new language was going to be "Common" (that is, common to many hardware architectures) and "Business Oriented," it ended up being named COBOL.
The response to this request by Department of Defense was enthusiastic; they were having the same kinds of problems that these business leaders were having.
DoD operated over 200 computers, and had almost another 200 ordered for delivery. Their software development costs were quickly increasing as well, and they had spent over $200 million on programming.
The Director of the DoD's Data System Research Staff, Charles A Phillips, convened a meeting with the group at which the key features of the new language were laid out. COBOL was supposed to:
- work the same on many different computers
- encourage more people to become programmers, by using a lot of plain English keywords and straightforward syntax
- be capable of change
- not be limited by current hardware technology
- be easy to use.
The result of this meeting was the fairly rapid development and release of the first version of the language, called COBOL-60 (it was released in 1960). It was heavily influenced by FLOW-MATIC — its inventor, Grace Hopper, was a technical consultant — and also incorporated a few ideas from IBM's COMTRAN.
The early development of COBOL faced a lot of problems which threatened to derail the whole process — the conflicting interests of manufacturers, academics, business leaders, and the military; the design-by-committee approach; commercial and personal rivalries; laughably short deadlines.
And yet, despite these problems, the effort to create COBOL accomplished something amazing. The initial meeting to discuss it was held in April 1959, and the initial specification was approved in January of 1960.
Computer manufacturers immediately started writing compilers for the language. Before the end of 1960, the first working COBOL program was written, compiled, and run on two different computer systems.
COBOL gained traction very quickly and became the dominant language for business computing, almost over night. By 1970, it was the most used programming language in the world.
COBOL also anticipated the Open Source and Free Software movements that wouldn't really begin for another two decades. Given the way COBOL developed, no one company or group could take ownership of it. The original language manual carried the following notice:
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.
COBOL releases are named for the year of their release. (And in true COBOL fashion, these years are represented with two digits until the 2000s ).
- COBOL-61 was mostly devoted to bug fixes and clarifications, making the syntax unambiguous.
- COBOL-65 continued with the work of cleaning up the language, and also added features for working with tables and mass storage files.
- COBOL-68 was intended to standardize the language, after some amount of version divergence with 61, 61 Extended, and 65. It was created under the auspices of the United States of America Standards Institute and was known as ANSI-COBOL. This version became the basis for further development of the language.
- Between 1968 and 1973, the original language development committee (named CODASYL) released four new language specification versions. These added a number of new features. Unfortunately, almost no one using COBOL was aware of them. The focus of most of the language's developer community was on the ANSI standard.
- COBOL-74, a revision to the ANSI standard, contained a number of new features including file organizations,
DELETE, and a memory segmentation module. This was a major change that was not backward compatible; programs written in earlier versions could not be compiled on COBOL-74 compilers.
- A proposed 1980 revision (unofficially called COBOL-80 by convention) introduced even more changes to the language, causing an uproar over backwards compatibility and the cost of converting old systems to the new language. The public response during the review period was overwhelmingly negative.
- COBOL-85 was the end result of the response to COBOL-80 release. ANSI addressed most of the concerns raised by the developer community, and the 1985 release posed a relatively low conversion cost, while adding a number of useful features that increased programmer productivity.
- COBOL-2002 was the culmination of work beginning in the early 1990s to add Object-Orientation to the language. It also added additional data types (bits, booleans, floating points, and binaries), support for UNICODE, pointers, and several other features. While this was a huge step forward for COBOL, it was not well supported by the industry. No compilers were written that supported the entire language specification.
- COBOL-2014 added a handful of additional features. Unfortunately, again, no compilers support the full standard. Additionally, there is very little new development being done in COBOL; by 2014 the overwhelming majority of COBOL work was being done on legacy systems.
While there is certainly plenty of existing code written in COBOL-2002, and even a bit in COBOL-2014, the majority of still-running legacy COBOL conforms to the 1985 specification.
About the Language
COBOL is imperative and procedural. The 2002 specification added Object Orientation, but these additional features are relatively underused.
The language has an English-like syntax, which was intended to make it easier to read and write. It is extremely verbose compared to most other languages: there are over 300 reserved words, and most programming tasks require more lines of code in COBOL than they would in other languages.
A COBOL program is separated into four divisions:
- Identification Division, identifies (names) the program, class, or interface
- Environment Division, defines configuration values
- Data Division, which has six sections, defines the data model of the program using hierarchical data structures
- Procedure Division, the heart of the program — containing procedures which process data.
COBOL keywords are written in
ALL CAPS, and a single line of code follows a particular format.
Lines are 80 columns wide ( a holdover from punch-card days ), with portions of the line reserved for particular use.
For example, the first 6 columns are either not used at all, or simply used to manually type line numbers (they are simply ignored by the compiler — another punch card holdover). After that:
- Column 7 indicates comments (
/), continuation from the previous line (
-), or debugger code (
- Columns 8-11, called Area A, contains headers for Divisions, Sections, and Procedures, or level-numbers for data defintions.
- Columns 12-72, called Area B, is free-form code space
- Columns 73-80 are historically left blank (for additional punch card information).
Here is an example
IDENTIFICATION DIVISION. PROGRAM-ID. example-hello. PROCEDURE DIVISION. DISPLAY "HELLO 1977!" STOP RUN.
(These strict spacing formats are not required in COBOL-2002, but they are still largely observed.)
COBOL has been around for a long time, so there are a lot of resources for learning it. If you are working on a legacy COBOL project, make sure that you know which version it is, and that your reference materials match it.
- COBOL Tutorial from Tutorials Point
- COBOL Tutorial at Mainframes 360
- COBOL Programming — Tutorials, Lectures, Exercises, Examples, from the Department of Computer Science and Information Systems at the University of Limerick
- COBOL Programming Tutorial
- ZingCOBOL: A beginner's Guide to Programming in COBOL
- Reading COBOL Layouts
- COBOL Tutorial from Academic Tutorials
- GNU COBOL Compiler, translates COBOL into C and then compiles it, designed to work with the GNU Compiler Collection
- zCOBOL, another COBOL compiler
- Hercules System/370, ESA/390, and z/Architecture Emulator, a mainframe emulator
- Open Source COBOL Tools, a collectoin of GNU-licensed COBOL tools.
Community and Ongoing Learning
- Beginning COBOL for Programmers by Michael Coughlan
- Murach's Mainframe COBOL by Mike Murach
- Cobol Unleashed by Jon Wessler
- Sams Teach Yourself COBOL in 24 Hours by Thane Hubbell
- COBOL for the 21st Century by Nancy Stern
- Advanced COBOL for Structured and Object-Oriented Programming by Gary DeWard Brown
- Murach's Structured COBOL, by Mike Murach
- COBOL For Dummies by Arthur Griffith, and don't miss the COBOL for Dummies Quick Reference by John W Fronckowiak
- The Power of Cobol by Rui Bivar de Oliveira
- Cobol Programming by MK Roy.
Should I Learn COBOL?
COBOL is not cool, and people have been calling it a dying language for over a decade. There was even a tombstone for COBOL before the language was even completed. But for all the proclamations about the irrelevance of COBOL, the truth is that COBOL is not yet dead.
COBOL was primarily used by large enterprises — companies that needed and could afford mainframe computers in the 1960s, 70s, and 80s. The systems from that era which have not been replaced are too complicated to easily re-build, and they are too mission critical to risk breaking.
Software systems in industries as diverse as traffic control, healthcare monitoring, insurance underwriting, financial auditing, and government record-keeping continue to run COBOL, and will likely continue to do so for some time.
And, most of the programmers who built and maintained these systems are approaching (or well past) retirement age.
At the same time that older COBOL programmers are aging out of the system, younger programmers are not much interested in older technology. IT managers in legacy industries are concerned of the coming COBOL shortage.
This presents a huge opportunity for early-career developers who are interested in stable, high-paid employment.
Other things to learn
With vanishingly rare exceptions, COBOL is not used for building new applications or systems. Rather, COBOL was used for building many large-scale business systems which still exist.
A COBOL programmer is most likely going to spend their time maintaining legacy systems, converting COBOL applications to modern technology, or building bridges between COBOL application and other systems.
Most of this work will tend to be on large mainframe computers; with well-established companies; in mature industries like finance, healthcare, government, and transportation.
Given that this is the ecosystem in which most contemporary COBOL development takes place, there are a number of additional technologies that a programmer needs in order to make COBOL skills relevant and valuable.
Here is a short list of skills that pair well with COBOL, and links to resources for learning:
- Mainframe Computing
- What On Earth is a Mainframe? by David Stephens
- Customer Information Control System (CICS®)
- Murach's CICS for the COBOL Programmer by Menendez and Lowe
- Designing and Programming CICS Applications by Horswill et al
- Job Control Language (JCL), an automation language heavily used in COBOL environments
- Murach's OS/390 and z/OS JCL by Menendez and Lowe
- System 390 Job Control Language by Gary DeWard Brown
- DB2 for the COBOL Programmer, Part 1 by Garvin and Eckols, and DB2 for the COBOL Programmer, Part 2 by Garvin and Prince.
- Newer Enterprise-level technologies, such as:
- Other legacy languages, such as:
- System programming languages, such as C, C++, and D.
- Data transport technologies, especially XML and SOAP
- Utility scripting languages such as Perl and Python
Further Reading and Resources
We have more programming guides, tutorials, and infographics related to coding and developer resources:
- Assembly Language Introduction: whether you are using it directly and learning it just to understand what is really going on at the hardware level, assembly language is a great thing to know.
- Bash Programming Resources: if you are coding COBOL, you will likely be using a command line environment. Here's your chance to learn one of the best.
- NXT-G Programming Resources: okay, this has nothing to do with COBOL. But after a long day of coding, wouldn't you enjoy creating LEGO robots?!
What Code Should You Learn?
Confused about what programming language you should learn to code in? Check out our infographic, What Code Should You Learn?
It not only discusses different aspects of the languages, it answers important questions such as, "How much money will I make programming Java for a living?"