What is COBOL and Who Still Uses It?
Many COBOL developers are nearing retirement age, and younger coders are less likely to learn it. This means that when problems arise, many companies no longer have a COBOL expert on hand. But it’s still used extensively: more than 95% of ATM swipes and 43% of banking systems are written in COBOL. Experts estimate that COBOL systems support more than $3 trillion in daily commerce through transaction processing.
In fact, one study found more than 800 billion lines of COBOL code in daily use! Let's examine what COBOL is, who uses it, and why.
What is COBOL?
COBOL, or COmmon Business-Oriented Language, is a procedural programming language created in 1959 focused on readability, self-documentation, and ease of use. Procedural programming means a programmer tells the computer what to do step by step. Object-oriented programming, on the other hand, is where the developer designs classes to represent the data getting passed to and from the computer.
One of the easiest ways to understand COBOL — or any programming language, for that matter— is to see a snippet of its code. It's perfectly OK if you understand very little of it. The purpose of this showcase is to go over COBOL's trademark readability.
This code snippet is an example of COBOL and, consequently, procedural programming. Notice that there are no defined objects. This script simply tells the computer what to do from line 1 to line 30, where we end the program.
Notice also that on lines 6 through 8, COBOL needs to know the type of data being used and how many digits it will be. In other words, this is how we would like COBOL to "picture" the data, thus the PICTURE keyword.
In this code, the easiest part to understand will likely be the middle part—the portion that begins with MAIN-PROCEDURE. For example, on line 13, we instantiate FIRST-NUMBER with the number 8. In new and less verbose languages, this would be done by declaring FIRST-NUMBER = 8. However, as specified in its name, COBOL was meant for business-oriented folks, not mathematicians. So, the idea was to make it as readable as possible.
Let's take a look at the same program, except written in Python:
Notice that this program only takes ten lines to write, while the COBOL program takes 25 to write. COBOL sacrifices verbosity for readability, while Python sacrifices readability for brevity. (Though if the code is written well, that shouldn't necessarily matter.) The Python program could easily be written in one line, and for as many variables as we choose.
So why is an article about COBOL bringing up Python? Nearly every programmer will understand this Python code, but not so much the COBOL code. Therein lies the problem that companies today are facing.
The average age of a COBOL developer is between 45 and 55, which means they will soon be leaving the workforce. On top of that, there are only an estimated 24,000 COBOL programmers in the US. This leaves very few professionals to maintain these legacy systems — and professionals who could learn it avoid it like the plague.
One reason is that COBOL is not particularly easy to write. Every line written above is mandatory. In other words, the program will crash even if the period on the last line is missing.
Who Still Uses COBOL?
Any company using COBOL today is doing so because they must. The companies come from various industries—most notably, insurance agencies, banking industries, and the government sector.
Small companies today can rewrite their code fairly easily using a more modern programming language. However, huge companies or bureaucracies will have millions of lines of COBOL code to grapple with, and rewriting this critical business logic is a massive project.
What's worse, these millions of COBOL codes are more than likely completely undocumented. Not only is there no documentation, but the folks who wrote it probably left the company 10 or 20 years ago. This leaves these companies in quite a bind because, as COVID-19 taught us, this COBOL code is not particularly scalable, and there are few professionals to maintain the code for scalability or oversee a transfer.
The COBOL Dilemma
Here is a quick scenario to illustrate the hurdle these companies are attempting to overcome. Let's say that you are a Python programmer. You have been charged with rewriting 20,000 lines of COBOL code into Python so that the code can become cloud-scalable.
These 20,000 lines of code are for a major bank, so you will be rewriting transactions, bank records, and interest calculations. In other words, any code that is miswritten could cause millions of dollars in damage in a highly regulated industry. Also, you will be re-writing this code without any real knowledge of what the existing code actually does.
Would you want that job? Probably not, and very few do. After all, modern languages like Python and COBOL are very different beasts, as shown above. This is the unfortunate COBOL quagmire many companies and federal agencies have found themselves in. COBOL code is unlikely to be removed anytime soon because there are not enough professionals with the technical know-how to do so, there is a lack of technical documentation, and the business logic is too critical for any rewrites.
There are many hurdles to overcome with a COBOL rewrite. The best way to perform this Herculean task is very slowly and incrementally. The only other option is to accept COBOL and begin rigorously training new computer science graduates in the art of procedural programming. The company will decide whether the latter or former decisions are more desirable.
Final Thoughts about COBOL
There are ways to slowly disengage with this outdated programming language. COBOL, in and of itself, once revolutionized the business industry, and is by no means a "bad programming language." The issue lies in its scalability, maintainability, and upgradability.
Scalability: Unless we deploy COBOL to the cloud, there is no way to scale it.
Maintainability: Unless we pull COBOL developers out of retirement or train unenthusiastic newbies in its art, there will be no way to maintain it.
Upgradability: We will not be able to upgrade unless we study and document tens of millions of lines of source code.
By now, you hopefully understand how Cold War-era programming language has become vital to national security. A better understanding of COBOL and why it is still used can help IT professionals determine how to work with it (or phase it out, if possible) at their own organizations.
delivered to your inbox.
By submitting this form you agree to receive marketing emails from CBT Nuggets and that you have read, understood and are able to consent to our privacy policy.