COBOL is an acronym of Common Business Oriented Language. COBOL is a high-level language. It was developed by CODASYL Committee (Conference on Data Systems Language) in the early 1960s. COBOL was mainly developed for business, finance, and administrative system. It was mainly utilized in banking systems, Insurance applications, and government bodies. COBOL has primarily used language in the mainframe systems.

COBOL is still in demand. According to the Bureau of Labor Statistics, there are companies that are still looking for COBOL programmers. However, they are also mentioned that they have seen some decline in the demand. The pay scale of COBOL programmers is also good. On average, COBOL programmers can make anywhere between $115K to $150K per year.

  1. Cobol Programming Language Main Features
  2. Programming Basics
  3. 3 Main Concepts for Programming
  4. COBOL Program Architecture
  5. Types of Divisions
  6. COBOL Coding Rules
  7. Program Syntax Rules of COBOL
  8. Variables in COBOL
  9. Reserved and Defined Words
  10. Characters
  11. Divisions Explained

Tutorial How to program in COBOL programming language

Who is the audience of this article?

The programmers who want to learn COBOL Programming for use in Banking, Insurance, and Government sectors. Even the audiences who want to have crust knowledge of mainframe or a beginner.

Best way to learn COBOL

COBOL is an interesting programming language that is widely used in different sectors. So learning COBOL can surely help you achieve a lot of things. But, how do you approach learning it?

Well, you have a lot of options to learn. The first being is to stick to our site where we periodically cover COBOL and other programming languages.

Apart from that, you also have plenty of options to get your hands dirty with COBOL.

But we are not talking about resources here. But, how to approach learning COBOL.

As with other programming languages, the best approach is practice. COBOL is a rigid programming language which means that it is not easy to learn. In fact, COBOL can be categorized as fairly “difficult” to get started and master. The main reason behind it is because of its old approach which is different compared to modern programming language.

But, it is not that you can never learn or master it. The key here is to keep practicing. If you are just starting out with programming, then it can take anywhere between 6-12 months to get good with COBOL. Wondering what time it takes if you are already familiar with programming? In that case, you can expect anywhere between 3-6 months to learn it.

Before you dive deep into COBOL, you need to understand where it is primarily used. COBOL is mainly used for Mainframe.

What is Mainframe?

A mainframe is an ultra-high-performance machine developed for heavy load, processor-intensive computing. They are mostly used by large businesses and for scientific purposes.

They are heavily used by enterprises. This means if you are looking to learn COBOL, you are inherently going to the mainframe career. Well, a Mainframe career is a niche approach and you will surely able to work with excellent clients and big businesses. However, it does lack the necessary flexibility that you may want when it comes to growing your career or looking for other opportunities.

Cobol Programming Language Main Features

  • It can handle a huge amount of data thanks to filing management.
  • It has a human-like logical structure easier to read and modify.
  • You can find testing and debugging tools throughout many platforms.
  • You can easily debug in COBOL as it has different divisions.
  • COBOL has the capability to handle business data efficiently because it was designed for business-oriented applications.

History of COBOL

  • CODASYL designed COBOL in 1959.
  • IBM announced that they want COBOL to want to be the primary development language in 1962.
  • In 1965, COBOL introduced key features such as tables and mass storage files.
  • In 1968, ANSI standard language approved COBOL for standard commercial use.
  • By 1970, COBOL becomes one of the most used programming languages in the world.
  • From 1982 to 1985, ISO worked with COBOL to accept it as ANSI proposed standard.
  • In 2002, COBOL introduced an object-oriented paradigm.
  • In 2014, COBOL introduced new features such as Dynamic capacity tables and Method overloading.

Programming Basics

In this section, we will learn basic programming in general, and particularly COBOL programming. Here we will pass through some simple COBOL programs by using the main programming.

  • Constructs
  • Sequences
  • Iterations
  • Selection

Please don’t worry if you don’t understand all the above terms at this level. You will be an expert soon.

A program is a collection of statements written in a language the computer understands.

A computer executes program statements one after another in sequence until it reaches the end of the program unless some statement in the program alters the order of execution.

Computer Scientists have shown that any program can be written using the three main programming constructs; Sequences, Iterations, and Selection.

This section introduces COBOL programming by writing some simple COBOL programs using these constructs.

3 Main Concepts for Programming

Any program consists of three main things:

  1. The computer statements needed to do the job
  2. Declarations for the data items that the computer statements need.
  3. A plan, or algorithm, that arranges the computer statements in the program so that the computer executes them in the correct order.

COBOL Program Architecture

COBOL Program is organized in hierarchical. It is not mandatory to add all components in all programs.

COBOL Programming structure

Here, are various components of the COBOL program:


A division is a block of code, which usually contains one or more sections. It starts where the division name is encountered. It ends with the beginning of the next division.


Sections are the logical subdivision of the program logic. It is the collection of paragraphs.


Paragraphs are the portion of a selection which is a user-defined or predefined name. Normally, a period follows it. This section itself includes zero or more sentences.


These elements represent a combination of single or multiple statements. They can only take place in the procedure division.


These are organized structures of COBOL programming language. They also take part in the processing.


These are the lowest in the hierarchy which cannot be divided.

Types of Divisions

Various divisions in COBOL program structure are as follows:

  • Identification Division
  • Environment Division
  • Data Division
  • Procedure Division

Identification Division

  • Programmers and compilers will be using this division for program recognition.
  • The program ID division is uniquely compulsory.
  • This is the identification of the name of the program containing characters.

Environment Division

It helps you to identify input and output files to the program.

COBOL Coding Rules

Here, are some most important coding rules while working with COBOL:

  • The sequence numbers represent the first six character positions.
  • The asterisk (the continuation character) is located in the seventh character position.
  • Column 8 is where the real program text starts.
  • The fourth positions from 8 to 11 are known as Area A, and positions from 12 to 72 are called Area B.

Program Syntax Rules of COBOL

Here, some important syntax rules of COBOL:

  • COBOL has syntax, which is very similar to the English language that was designed to be self-documenting and very readable.
  • Example: y = x; is represented with: MOVE x TO y
  • It is not a case sensitive language.
  • It has more than 300 reserved words
  • Complex conditions can be “abbreviated” by removing repeated variables and conditions.
  • It lacks big size standard library, as it has only 43 statements, 87 functions, and just one class.

Variables in COBOL

In COBOL variable represents a certain location in memory where data is stored and fetched by the program. The location name identifies the area of memory that is reserved for the variable.

Variables must be described in terms of their size and type. Every variable used in a COBOL program should have encryption in the DATA DIVISION.

Rules for declaring variables in COBOL

  • Variables are required to be declared in the working-storage section. They might be arrays, records, file descriptor records, etc.
  • The name of a variable may have alphanumeric, with its first character as an alphabet.
  • Only allowed special character used and can have the only hyphen in it which must be embedded
  • 9 represents only a single-digit number.

Reserved Words

A reserved word represents a character-string with a pre-arranged meaning in a COBOL source program.

There are several types of reserved words in COBOL.

1) Keywords: they appear in uppercase. ADD, READ, etc.

2) Optional Words: they improve readability. GIVING, AFTER, etc.

3) Figurative constants: they refer to constant values. ZEROES, SPACES, etc.

User-Defined Words

They are constructed and used by the application programmer. They are normally used To-define paragraph names, SECTION names, file names, temporary variables

The following are the rules for forming user-defined words.

The length may be up to 30 characters.

  1. Only letters, digits, and hyphen (-) are allowed.
  2. Embedded blanks are not allowed.
  3. At least one character must be alphabetic.
  4. Cannot be COBOL reserved words.
  5. May not begin or end with a hyphen.


The most basic and indivisible unit of the COBOL language is the character. The COBOL character set includes 78 characters that can be classified as letters of the alphabet, digits, and special characters.

Identification Division

As the name suggests the ‘Identification Division’ identifies the program to the programmer and the compiler. Most of the entries in the Identification Division are directed at the programmer and are treated by the compiler as comments. The paragraphs of the Identification Division are:


An exception to this is the Program-ID clause.  Every COBOL program must have a PROGRAM-ID.   It is used to enable the compiler to identify the program.

There are several other informational paragraphs in the Identification Division but we will ignore them for the moment.

Environment Division

The Environment Division is an optional division and includes two sections namely CONFIGURATION SECTION and INPUT-OUTPUT SECTION.  Most of the entries in this division are machine-dependent and hence readers are advised to consult system manuals for this implementation-specific information.

Configuration Section

The Configuration Section includes two paragraphs which are the SOURCE-COMPUTER paragraph and OBJECT-COMPUTER paragraph.

  • The Source-Computer paragraph denotes the computer where the source program will be compiled.
  • Object-Computer paragraph denotes the computer where the object program is designated.

Input-Output Section

The Input-Output Section consists of two paragraphs namely File Control paragraph and I-O CONTROL paragraph.  In the FILE CONTROL paragraph, a file name is selected for each file to be used in the program and assigned to a device.