What is COBOL? COBOL programming explained
Some technologies never ever die—they just fade into the woodwork.
Request the regular software program developer about COBOL (Frequent Business Oriented Language) and they’ll glimpse at you as if you mentioned carbon paper, leaded gasoline, or the 78 RPM history. In contrast to modern day languages like Go or Python—or even Pascal or C!—COBOL would seem wordy, clunky, passé.
But COBOL has endured. Far from an obsolescent engineering we’ve happily parted enterprise with, COBOL has become an institution. Enormous COBOL codebases are nevertheless in use about the environment, lots of of them working virtually just as they have been when very first designed. In Hollywood parlance, the COBOL language has “legs.”
So, yes, COBOL is nevertheless pertinent and timely—painfully so, in point. In the latest months COBOL has re-entered the general public consciousness, as states like New Jersey have set out a call for programmers to assist move their COBOL programs into the twenty first century.
In this piece we’ll glimpse at COBOL’s origins, how the layout of the programming language stands out even currently, and what would make COBOL both so enduring and so intractable.
COBOL record
COBOL arose in the late fifties and early sixties. The enhancement of the language was a challenge sponsored by the United States Department of Defense (DoD) that involved a consortium of computer corporations such as IBM, Honeywell, Sperry Rand, and Burroughs. The objective was to generate a programming language with the pursuing attributes:
- Portability amongst computer systems, thus creating it less difficult to migrate software program both throughout generations of hardware and amongst hardware makers.
- More English-like syntax than other languages of the time (e.g., FORTRAN) as a way to stimulate programming by a wider audience, even if at the cost of some operational pace.
- The capability to accommodate long run variations to the language.
The very first official COBOL specs came out in 1960. About the subsequent ten years, and to the consternation of its critics, COBOL turned the default selection for producing enterprise programs. One particular purpose for its rapid spread was network effects: IBM, a single of the authentic collaborators on the language, turned an aggressive early adopter, and IBM’s dominating existence in the computing environment aided contribute to COBOL adoption.
Due to its layout rewards and heavyweight field backing, COBOL has caught about, outliving the authentic systems it was created for by a extensive margin. According to numerous estimates, by 1970 COBOL was the most broadly applied programming language in the environment. By 1997, COBOL was thought to be working some eighty per cent of enterprise applications.
COBOL language
The designers of COBOL broke with the terse syntax of other programming languages at the time (yet again, these as FORTRAN). The idea was to generate a programming language that could be study and comprehended by non-programmers, significantly accounting, finance, insurance, and other enterprise pros.
Take into account a “hello world” method penned in an early dialect of COBOL:
IDENTIFICATION DIVISION.
Method-ID. Hello there-Earth.Treatment DIVISION.
Display screen 'Hello Earth!'.
Conclusion-Display screen.
End Run.
For modern day software program builders reared on the terseness of languages like Python, this code is verbose. But the verbosity of COBOL (if not its execution) springs from the exact same conceit that informs modern day languages like Python — that code is study lots of additional occasions than it’s penned, so it need to be penned to be readable.
A equivalent method in a additional modern day model of COBOL might glimpse something like this:
method-id. hello.
course of action division.
exhibit "Hello there environment!".
quit operate.
When this instance is additional concise, the exact same essential ideas apply: The code strives to be express about what’s heading on at every phase.
COBOL has strict procedures relating to syntax and the internal organization of programs. A COBOL method is explicitly divided into sections, or divisions, that make it less difficult to identify and realize its parts at a glance:
- Identification division: Basically a metadata area, containing facts about the method, its author, and so on.
- Ecosystem division: Has facts about the runtime atmosphere, for occasion aliases for exterior units, which might need enhancing when working the method on distinct hardware. This aided portability of a method amongst systems, where for occasion I/O might be dealt with fully differently.
- Facts division: Containing file and doing the job storage sections, the Facts division describes the data files and variables (respectively) applied in the method.
- Treatment division: The true method code life listed here, broken into reasonable units called sections, paragraphs, sentences, and statements. It is tempting to analogize these constructions to modules or capabilities, since they provide roughly the exact same capabilities (dividing code into blocks, with constrained inputs and outputs) but they are much considerably less flexible.
COBOL also has incredibly strict formatting procedures for the code, down to the number of spaces previous a command. (Python consumers will discover this familiar!) Some of these restrictions are a by-product of COBOL’s coming-of-age all through the mainframe period of the sixties, when programs have been encoded on punched playing cards and the correct formatting of eighty-column strains mattered. But other formatting restrictions implement readability.
The idea guiding the strict regimentation of COBOL programs is to make them as self-documenting as achievable. Soon after all, COBOL programs tended to keep on being in spot for yrs or a long time on close. The intent (if not usually the close result) was to make every COBOL method an artifact that any COBOL programmer could realize, even yrs later on, devoid of the assist of the programmer who designed it.
COBOL worries
Considerably of COBOL’s ongoing prevalence—and inertia—comes from the point that COBOL programs, as soon as penned, tended to be still left in spot indefinitely, with only slight modifications. The more substantial and additional mission-crucial the application, the considerably less probably it was to be disturbed. Mainframes, like IBM’s choices, performed a vital function: They have been created to be highly backward appropriate and to operate legacy software—like COBOL apps—across generations of hardware with nominal modifications. The result: Billions of strains of COBOL code working essentially unchanged for a long time on close.
About the yrs, COBOL has advanced, if little by little. It even now has an item-oriented variant, OO-COBOL, which features support for modern day attributes like Unicode, locales, and additional superior information styles outside of strings and integers. But COBOL aggressively retains backward compatibility, so even these enhancements and extensions adhere to the mandate that present COBOL programs need to proceed to operate.
Not all of COBOL’s language layout options have been well-known with COBOL programmers. Some have led to overly sophisticated programs that proved hard to realize or debug, discouraging rewrites or enhancements. COBOL’s GO TO
command, like its counterpart in C, allowed programmers to bounce freely about a method, and thus compose additional potent programs. But undisciplined use of GO TO
could flip a COBOL method into a rat’s nest of difficult-to-trace cross-references.
COBOL programming currently
COBOL survives currently in a several incarnations. IBM actively maintains its individual COBOL implementations and sustains lots of present COBOL programs where they operate. Micro Aim COBOL is a business COBOL version that operates on Microsoft Windows, compiles COBOL programs to Java and .Web, and even deploys to cloud environments like Azure. You’ll also discover open up supply implementations of COBOL, these as GnuCOBOL, which are freely offered and compile to indigenous machine code. On the other hand, they may lack some of the additional superior deployment or debugging attributes of the business COBOLs.
When COBOL continues to be in extensive use, deep COBOL skills is turning out to be more challenging to come by with every passing calendar year. As a result, lots of former COBOL programmers have to be coaxed out of retirement to wangle older programs into the twenty first century. Often, it is not COBOL programming know-how that is most at a quality, but personal comprehension of the mainframe environments where COBOL operates. A lot of COBOL programs get the job done hand-in-hand with legacy engineering these as IBM’s IMS and CICS transaction management and database systems, all of which have to have skills that is more and more exceptional.
So, as aged-college as COBOL might appear to be, the need for COBOL language and enhancement-atmosphere skills has developed with every passing calendar year. Job listings for COBOL and associated skills abound. In March 2020, New Jersey set out an crisis call for COBOL programmers to assist enhance point out unemployment benefits systems in the wake of the COVID-19 crunch.
Understand COBOL
Finding out methods for COBOL are proliferating yet again, supplied the rising need for the language. Modern builders who want to get up to pace with this most enduring of languages have a several possibilities:
- The University of Limerick, in Eire, provides a entire COBOL programming course on-line, courtesy of its Department of Computer system Science and Information Units. It is not as up-to-date as some other methods, but supplied how minimal COBOL variations with time, that is not essentially a defect.
- The Open up Mainframe Project also provides COBOL methods. One particular is a full course in COBOL programming, co-sponsored by IBM. It is additional modern day than the University of Limerick course, and tailored to IBM’s zOS implementation of COBOL, which is a broadly deployed model of the language.
COBOL has been a staple of enterprise computing for a long time, and the need for COBOL programming expertise only proceeds to grow. If sustaining or modernizing COBOL programs pursuits you, the time would seem riper than at any time to dive in.
Copyright © 2020 IDG Communications, Inc.