What is COBOL(Common Business Oriented Language)?

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.
  • In 1970, COBOL had become the widely used programming language in the world.
  • ISO installed SC5’s first Working Group: WG4 COBOL in 1982.
  • 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 allwoed in AREA A.
  • Program name area : colums 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.
  • Envioronment 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.

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:

filter_none

edit
close

play_arrow

link
brightness_4
code

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

chevron_right


Output:

Hello World!

Advantages

  • COBOL is self-documented.
  • It has ENGLISH-like so it os easy to understand and read.
  • It can handle huge volumes of data easily.
  • It is widely used across business appplications, admistrations, 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.
  • Comiplation 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.



My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.