Open In App

What is COBOL(Common Business Oriented Language)?

Last Updated : 31 May, 2022
Improve
Improve
Like Article
Like
Save
Share
Report

COBOL an acronym for Common Business Oriented Language is a computer programming language, which was designed for business use. COBOL was procedural in the beginning, but since 2002, COBOL became object-oriented. COBOL was developed by Conference of Data System Languages(CODASYL).

What-is-COBOL

COBOL is primarily used in business, finance, and administrative systems for companies and governments. COBOL is still widely used in applications that are based on mainframe computers like transaction processing jobs. But nowadays, due to the retirement of experienced COBOL programmers, new programmers are shifting to different platforms, which are written in modern languages.  

History

In the late 1950s, computer manufactures were concerned about the huge cost of programming. In 1959, a survey had found that the cost of programming is around US $8, 00, 000 for any data processing installation, and when it comes to translating a program to run on a new machine, it would cost around 6 million dollars. When new programming languages were increasing at a huge rate, the survey also suggested that if a common business-oriented language were used, then the translation would be faster and cheaper. So, on 8 April 1959, Mary K. Hawes, a computer scientist at Burroughs Corporation, called a meeting of computer users, and manufacturers at the University of Pennsylvania to organize a formal meeting on common business languages. 
Thereafter, the updates of COBOL are as follows: 

  • COBOL was first designed in 1959 by CODASYL.
  • In 1962, IBM announced that COBOL will be their primary language for development.
  • In 1965, COBOL has the feature of handling mass storage files and tables.
  • In 1968, COBOL was approved by ANSI for standard commercial use after resolving in compatibilities between different COBOL versions that had been introduced by various producers of COBOL compilers since the language’s creation in 1960.
  • In 1970, COBOL had become the widely used programming language in the world.
  • ISO installed SC5’s first Working Group: WG4 COBOL in 1982.
  • Four Standards for COBOL have been Produced in 1968,1974,1985 and 2002.
  • In 2002, first Object-oriented COBOL was released.
  • In 2014, COBOL has the features like Method overloading, Dynamic capacity tables, etc. 

Syntax of COBOL

COBOL has an English-like syntax, which is used to describe almost everything in the program. 
For example, a condition expression can be represented as: 

x IS GREATER THAN y


To have such English-like syntax, COBOL has over 300 reserved keywords. Some keywords are simple, and some are plural of a keyword; e.g. VALUE and VALUES.
Code Format:  

  • Each COBOL program has 80 characters in each line.
  • First six letters are used for card/line numbers, this area is ignored by the compiler.
  • The seventh character is the Indicator area, which describes a continuation using a ‘‘ OR a comment using an ‘* or /‘.
  • AREA A: next four characters(8-11) contains the DIVISION, SECTION, and the procedure headers.
  • AREA B: columns 12-72 contains any code which are not allowed in AREA A.
  • Program name area : columns 73 -80 are used for identification.

Variable Declaration:  

  • In COBOL variable is a named memory location, which can be used by a program to store some data and from which it can get data.
  • Every variable must be mentioned in DATA DIVISION.
  • It can have a maximum of 30 characters.
  • It can be alpha-numeric, but first character must be a letter.

Types of Divisions

There are four types of divisions in COBOL : 

  • Identification Division: 
    It is the only mandatory division of every COBOL program. To identify a program, the programmer and the compiler both use this division. Program-ID is mandatory in this division. Program-ID means that the program name which consists of 1 to 30 characters.
  • Environment Division: 
    It is not mandatory to be written in the program. It describes the environment to the system in which the program will run. It describes the I/O sources which are required to run the program. It has two sections : Configuration and Input-Output sections.
  • Data Division: 
    It describes the data items referred by the program, which includes the names, lengths, decimal point locations, etc. It describes the names or items which are used in the program to refer a data for manipulations
  • Procedure Division: 
    It is used to provide some logic to the program. It consists of some executable statements using some variables or names which are defined in the data division. In every program, there must be at least one such procedure division. 

Applications

COBOL is a language that is used in business and administrative systems for companies and governments. Though this language is more than 50 years old, yet COBOL is an important part of our tech-driven world. It still accounts for more than 70% of the business transactions that take place in the world. COBOL is used in applications that are deployed on mainframe computers. 
COBOL is mainly used in large scale Batch and On-line transaction processing (OLTP) jobs.In Batch, there are larger programs that tend to handle a large number of records. This is the read-modify-write loop which is used in many COBOL programs. In OLTP the programs are executed parallelly by the Transaction Processing monitors within which they are developed and executed. There is a chance of performance improvement for such applications. 

Structure of COBOL Language –

COBOL is much more rigidly structured than most other programming language. COBOL programs are hierarchical in structure. Each element of the hierarchy consists of one or more subordinate elements. The program hierarchy consists of divisions, sections, paragraphs, sentences, and statements.

Hierarchical COBOL program structure ;-

Cobol




PROGRAM
  DIVISION (s)
     SECTION (s)
        Paragraph(s)
            Sentence(s)
                Statement(s)


A COBOL program is divided into distinct parts called “divisions”. A division may contain one or more “sections”. A section may contain one or more “paragraph”. A paragraph may contain one or more “sentences”, and a sentence may contain one or more “statements”.

How to work with COBOL

To work with COBOL, you have many options. Firstly download any IDE such as Sublime text 3 or Eclipse. Then install the COBOL plugin. For reference you can go to this link
Example:

html




IDENTIFICATION DIVISION.
PROGRAM-ID. HELLO-WORLD.
PROCEDURE DIVISION.
DISPLAY 'Hello world!'
STOP RUN.


Output: 

Hello World!

Advantages

  • COBOL is self-documented.
  • It has ENGLISH-like so it is easy to understand and read.
  • It can handle huge volumes of data easily.
  • It is widely used across business applications, administrations, and easy to maintain.

Disadvantages

  • To become a COBOL programmer, one must have a great knowledge of machine languages.
  • Since the language is English-like, therefore one must have to type a lot, which makes the code bulky.
  • Compilation time of a COBOL program is more than most of the machine programming languages.
  • It follows a very strict code format.
  • The number of experienced programmers of COBOL are retired.


Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads