What Is COBOL Programming Language? Definition, Examples, Uses, and Challenges

essidsolutions

COBOL (common business-oriented language) is defined as a standard programming language developed by a consortium CODASYL (Conference/Committee on Data Systems Language) in 1959 to support business and financial applications. This article explains the fundamentals of COBOL programming language, examples, uses, and the top five challenges it faces.

What Is COBOL Programming Language?

COBOL (common business-oriented language) is a standard programming language developed by a consortium CODASYL (Conference/Committee on Data Systems Language) in 1959 to support business and financial applications. The language was primarily conceived for mainframe computers and was not dependent on any particular operating system for its working.

COBOL is a user-friendly language that uses English words and phrases as a syntax of keywords and constructs. This natural language-inspired syntactical structure evolved from Grace Hopper’s 1940s work on FLOW-MATIC, a text-based data processing language. Languages such as COMTRAN and FACT significantly influenced the eventual design of COBOL.

Before the inception of COBOL, each operating system had a programming language of its own. However, this seemed to be a hurdle for several companies as they had to work with the systems of numerous brands. This led to the initiation of the COBOL project. The portable framework and usability made COBOL popular across disciplines such as banks, financial institutions, insurance companies, human resources departments, and government agencies. 

Since the 1950s, COBOL has had several versions; COBOL 60 being the first one, followed by COBOL 61, COBOL 65, COBOL 68, COBOL 74, COBOL 85, COBOL 2002, and the latest COBOL 2014. Although COBOL has ended its development, its programs are still in use and may continue to exist until the software is ready to migrate to a new alternative.

COBOL has several advantages over its rivals. Firstly, it is a portable language, which means that the language is reliant on any specific vendors. It supports operating systems such as Windows, Linux, mainframes, Unix, and others. Additionally, COBOL is accessible to anyone good at English grammar. Also, COBOL uses the self-documenting feature to ease maintainability by synchronizing the code and its documentation.

Key COBOL features

Let’s understand some key features that have allowed COBOL to stay relevant even today.

Key COBOL Features

1. Global business language

Several large enterprises, organizations, banks, financial firms, insurers, and industrial sectors such as healthcare, retail, automotive, shipping services, and others use COBOL for various reasons. For example, companies such as IBM, UPS, Fiserv, Bank of America, JPMorgan Chase, and Cigna still depend on COBOL. Thus, the language continues to play a crucial role in business computing that drives the global economy.

Despite the lesser developments in its versions, COBOL remains the language of choice across diverse markets and business lines. According to a Feb 2022 global survey by Micro Focus, around 92 percent of the survey-takers (software engineers, developers, IT executives, and architects from 49 countries) opined that COBOL applications are developed today to serve the strategic purpose of their respective organizations.

2. Easy readability

COBOL came into existence with the motto of developing a language that communicates better with computers. However, people observed that the demand for the language grew across industries with time. A lot of credit goes to the readability aspects of COBOL. It allows a layperson to learn and work with the language with proper training.

Moreover, the language does not use pointers, user-defined data types or functions, making it a simple language to understand.

3. Seamless integration with modern systems

COBOL is a legacy language that supports and integrates easily with most traditional deployments, architectures, modern technologies, and complex applications. For example, COBOL is compatible with Java, C#, and Docker containers and runs on newer platforms such as .NET and JVM. Moreover, it also functions in different cloud environments such as Azure and AWS.

With the rise in Service-Oriented Architectures (SOA), REST, and Web Services, new protocols and methods have come to the fore, including XML, HTML, WSDL, JSON, and SOAP. However, COBOL has ensured that the language integrates and connects seamlessly with modern applications and expands its functionality to the web, mobile, and cloud.

4. Portable language

COBOL programs run on different platforms. This allows the programmer community to develop value applications rather than worrying about compatibility with operating systems. The platform-agnostic aspect also allows developers to build, test, and deploy COBOL programs across various supported platforms, thereby speeding up the development and application execution process.

5. Evolving language

COBOL software uses standard IDEs that are prevalent in most industries. This makes it easier for today’s teams to check, review, and amend COBOL programs whenever required. Also, developers can use the latest IT tools and processes to execute and run programs developed on old contemporary systems.

COBOL’s adaptive and evolving nature has allowed the language to stand the test of time and merge with modern APIs, microservices, and cloud applications.

See More: What Is a Neural Network? Definition, Working, Types, and Applications in 2022

Examples of COBOL Programming Language

A typical COBOL program follows a hierarchical structure that has multiple interrelated components. Let’s look at the fundamental program structure of COBOL.

  • Characters: COBOL language contains 78 characters in the character set. This includes alphabets (A-Z/a-z), digits (0-9), and special characters.
  • Statement: Statements piece together verbs, words, keywords, and operands. They disclose the action performed on data to accomplish conditional or unconditional tasks.
  • Sentence: A sentence combines two or more statements and ends with a period.
  • Paragraph: A paragraph refers to the code snippet that combines sentences or statements. It starts with a paragraph name and ends with the paragraph’s scope terminator.
  • Section: A section code combines a set of sentences, blocks of statements, or paragraphs.
  • Division: Similar to sections, divisions are a combination of sentences, statements or paragraphs. A typical COBOL program has the following four divisions:
    • Identification Division: It is a mandatory division in a COBOL program that identifies the program. PROGRAM-ID specifies the name of the program.
    • Environment Division: This defines the input and files of a COBOL program.
    • Data Division: It defines the data used in COBOL programs, such as variables.
    • Procedure Division: This division contains the program logic, statements, and variables that are part of the data division. Users in this division define paragraph and section names. The division has at least one statement and ends with STOP RUN or EXIT RUN commands in calling and called programs, respectively.

 Let’s understand some of the examples of COBOL programming language:

1. A COBOL program to display ‘COBOL Program’

Program

IDENTIFICATION DIVISION.           

PROGRAM-ID. PRG1.                  

ENVIRONMENT DIVISION.              

DATA DIVISION.                          

PROCEDURE DIVISION.                

DISPLAY “COBOL Program!”.     

STOP RUN.          

2. A program accepts string input from the user and displays it on the screen.

Program

IDENTIFICATION DIVISION.                   

PROGRAM-ID. PRG2.                          

ENVIRONMENT DIVISION.                      

DATA DIVISION.                                 

WORKING-STORAGE SECTION.                   

77 USERINP PIC A(10).                      

PROCEDURE DIVISION.                        

ACCEPT USERINP.                     

DISPLAY “USER INPUT IS:” USERINP.       

DISPLAY “…….!”.             

STOP RUN.         

3. A program that performs arithmetic operations on two numbers is accepted as user input and displays the result.

Program

IDENTIFICATION DIVISION.                        

PROGRAM-ID. PRG3.                              

ENVIRONMENT DIVISION.                           

DATA DIVISION.                                      

WORKING-STORAGE SECTION.                        

77 NUMBER1   PIC 9(4).                         

77 NUMBER2   PIC 9(4).                         

77 TOTAL  PIC 9(5).                          

PROCEDURE DIVISION.                                 

ACCEPT NUMBER1.                                    

ACCEPT NUMBER2.                                    

ADD NUMBER1 TO NUMBER2 GIVING TOTAL.              

DISPLAY TOTAL.                             

DIVIDE NUMBER1 BY NUMBER2 GIVING TOTAL.             

DISPLAY TOTAL.                            

STOP RUN.  

4. A program that accepts user input temperature in degrees Celsius and converts it into Fahrenheit using the formula: °C x 9/5 + 32 = °F, (°F – 32) x 5/9 = °C.

Program

IDENTIFICATION DIVISION.                                       

PROGRAM-ID. PRG4.                                         

ENVIRONMENT DIVISION.                                      

DATA DIVISION.                                                 

WORKING-STORAGE SECTION.                                       

77 CELSIUS   PIC 9(3).                                 

77 FAHRENHEIT PIC 999V999.                               

PROCEDURE DIVISION.                                        

ACCEPT CELSIUS.                                        

COMPUTE FAHRENHEIT = (CELSIUS*(9/5)) + 32.         

DISPLAY FAHRENHEIT.                                    

STOP RUN.

5. A program calculates the rate of interest by accepting ‘P’ as the principal amount, ‘N’ as the time, and ‘R’ as the rate of interest from the user and using the formula (I=PNR/100).

Program

IDENTIFICATION DIVISION.                                 

PROGRAM-ID. PRG5.                                       

ENVIRONMENT DIVISION.                                    

DATA DIVISION.                                       

WORKING-STORAGE SECTION.                                 

77 P   PIC 9(2).                                 

77 N   PIC 9(2).                                 

77 R   PIC 9(2).                                 

77 I   PIC 9(4).                                  

PROCEDURE DIVISION.                                      

ACCEPT P.                                            

ACCEPT N.                                            

ACCEPT R.                                            

COMPUTE I = (P*N*R)/100                  

DISPLAY “RATE OF INTEREST IS…” I                      

STOP RUN.  

 See More: What Is a Decision Tree? Algorithms, Template, Examples, and Best Practices

Top 5 Uses of COBOL Programming Language

Mainframes refer to scalable systems that are used for large-scale data processing tasks. They are known to have good speed, storage, and security. As a result, they are being used in several modern applications. This is all thanks to COBOL, a programming language that is a crucial driving force for such mainframe systems.

Uses of COBOL Programming language

Let’s understand the top five uses of the COBOL programming language.

1. COBOL powers the financial industry

The foundational system code of the financial services industry is built on the COBOL programming language. The language came into being 60 years ago to serve the commercial purpose of processing large amounts of data at high speeds. However, despite its age, COBOL continues to play a crucial role in the financial services sector as many banks, insurance companies, and financial institutions still run on mainframes.

In the financial industry, systems process vast volumes of transactions and serve multiple users simultaneously. Such systems require a robust and safe language such as COBOL that can access, process, manage, and manipulate large quantities of data while performing accurate arithmetic functions and working at high speeds.

Additionally, introducing newer functionalities or updating legacy IT systems causes significant system errors. Any technical glitch leading to system downtime or failure in the banking sector can significantly impact transaction data and put sensitive data at risk. In these scenarios, it has been observed that COBOL tends to circumvent such system failures and, in turn, protects users’ sensitive data. 

2. COBOL supports legacy applications in the cloud

As organizations look to establish a robust digital footprint in this digital age, migrating applications to the cloud has become all the more important. Cloud computing provides reliable, secure, fast, and scalable services. Thus, moving mainframe or legacy applications to the cloud adds value to enterprises rather than keeping the business-critical data in their data centers.

Microsoft Azure and Amazon Web Services provide an IaaS platform that one can configure to run COBOL applications. This requires some recompiling of COBOL applications so that they stay compatible with the new virtualized environment.

Moreover, the environment offers features that allow users to edit, test, and debug COBOL applications to perform their tasks seamlessly. One may also need to create a COBOL-supported run-time environment to map the applications to the requisite resources and databases. This helps in COBOL application management in the cloud.

Thus, deploying COBOL applications in the cloud has advantages such as:

  • Reduces the operational and capital expenses necessary for mainframes
  • It gives elasticity to applications during high demand or peak times
  • Allows innovation of legacy applications with the new cloud infrastructure in place

3. COBOL supports ML-based tasks of deriving insights & predictions

Machine learning refers to identifying key patterns and relations between data to develop crucial insights and make predictions. The training and analysis phase of ML requires large quantities of data.

Fundamentally, mainframes are known to store vast amounts of data that they can use to train and analyze ML models. For example, IBM created ML for z/OS, also referred to as IBM MLz. It is based on an ML model that gives mainframes direct access to several ML libraries.

With systems such as IBM MLz, COBOL language supports the process of deriving valuable insights from mainframe data that allows businesses to make critical decisions.

4. COBOL enables real-time analytics

COBOL language supports the analysis of real-time transactions across industries. In April 2022, IBM announced IBM z16, a next-generation system that offers real-time AI for transaction processing. IBM z16 is an integrated on-chip Telum AI accelerator that can handle critical mainframe workloads and analyze real-time activities.

Such real-time systems are known for their high speed. For example, IBM z16 can handle 300 billion inference requests daily with a latency of one millisecond. Thus, with managed latency issues, IBM z16 can run deep learning models in real-time.

5. COBOL allows application modernization

Despite adding modern languages such as Python, JavaScript, and C++, several organizations rely on legacy mainframe applications written in COBOL language and have made heavy investments in it.

With newer development environments coming to the fore, it is necessary to adapt legacy COBOL applications to modern systems. This is achieved by using the products and advanced technologies available in the market, such as IBM’s Enterprise COBOL compiler, which enables easy integration without recompilation and maintains application performance.

As illustrated in the above postulates, COBOL programming language plays an essential role in mainframe systems that are key to today’s IT infrastructure.

See More: Top 10 Machine Learning Algorithms in 2022

Top 5 Challenges of COBOL Programming Language

As new programming languages and technologies such as Python, Java, JavaScript, Ruby, Hadoop, and cloud computing gain popularity, legacy technologies face a stiff challenge in staying relevant. However, large businesses still depend on COBOL-based legacy systems despite the technology boom.

Challenges of COBOL Programming Language

According to a Feb 2022 survey by Micro Focus, around 775-850 billion lines of COBOL code are in use today. This implies that large amounts of data are still a part of older technological systems. Hence, to modernize the older architecture, it is vital to offload, integrate, and transform the data tied to it onto modern systems.

Here are the top five challenges businesses face today while using the COBOL programming language.

1. Lack of skilled COBOL programmers

As highlighted earlier, several organizations today use the COBOL programming language. However, as the trend goes, there seems to be a significant shortage of skilled COBOL programmers.

According to a 2021 report by Advanced Software, 89% of large businesses feel that there is a significant shortage of IT talent capable of managing legacy systems. These legacy systems are primarily mainframes operating on the COBOL programming language.

Moreover, COBOL is not popular in academia, and most grad colleges and universities push for upcoming technologies and languages such as Java, C++, Linux, and UNIX. As a result, COBOL does not garner the required attention.

2. Requirement for custom development

Mainframes are complex IT systems that are difficult to operate and maintain. Moreover, querying such systems to extract and analyze relevant data is even more complicated. This requires the custom programming, development, and execution of instructions.

Custom development is an expensive and time-intensive process. Processing power is measured in terms of MIPS (million instructions per second), and billing is done for each executed instruction in MIPS. Hence, the overall maintenance and management of legacy mainframe systems follow a network of steps, which can be economically draining.

3. The absence of new resources

While COBOL provides a stable development environment, most of its resources, such as compilers, debugging tools, interpreters, etc., have reached their end of life. COBOL ended its development after the COBOL 2014 version. As a result, there exists an acute shortage of new resources that can replace the older retired ones. As such, it is a challenge for COBOL to keep the history of legacy systems going post the retirement of its crucial resources and support discontinuance for some COBOL components.

4. The increased cost of compilers and licenses

The compiler is one of the critical tools necessary to get your hands on the COBOL programming language. Although a few free and open-source compilers such as GnuCOBOL exist today, other compilers such as IBM COBOL and Micro Focus are pretty expensive. Most compilers that offer full COBOL functionality are costly.

Also, COBOL products offered by vendors such as Fujitsu Software NetCOBOL or Micro Focus require different licenses that a user may need to buy to activate the product. These COBOL licenses are expensive and further limit the use of COBOL programming language. This increased compiler and licenses cost causes a subsequent increase in the ownership cost for users or companies handling legacy applications.

5. Left behind by the age of digital transformation

As organizations strive to integrate digital technologies into all business areas, legacy systems using COBOL may soon take a backseat. Digital transformation allows enterprises to meet their business needs and satisfy customer demands without issues. As a result, it is making some older technologies obsolete.

Thanks to the digital age, companies are developing applications through newer languages such as Java, .Net, Python, etc. Thus, living in a modern digital age and using tools (COBOL) from an older age (legacy systems) may not make sense to most organizations today.

See More: What Is Super Artificial Intelligence (AI)? Definition, Threats, and Trends

Takeaway

COBOL programming language is alive and running, almost six decades after its formation. This is because COBOL is a highly reliable and flexible language. It performs well for organizations and financial institutions such as banks, where accuracy is the primary concern. COBOL’s superior performance leapfrogs languages such as Java.

Moreover, its usefulness and evolving & adaptive capabilities in this dynamic digital age enable innovation and reliability, which are vital necessities for any IT system.

Did this article help you understand the fundamentals of the COBOL programming language? Comment below or let us know on LinkedInOpens a new window , TwitterOpens a new window , or FacebookOpens a new window . We’d love to hear from you!

MORE ON ARTIFICIAL INTELLIGENCE