Skip to Content

COBOL Tutorial for Beginners

1 June 2026 by
Punit Kumar Trivedi
| No comments yet

Complete Guide with Examples

COBOL (Common Business-Oriented Language) is one of the most important programming languages in the mainframe world. This beginner guide explains COBOL fundamentals, program structure and syntax.

It is one of the oldest and most reliable programming languages in the world. Despite being developed in 1959, COBOL continues to power critical business applications in banking, insurance, healthcare, government, and large enterprises.

Many of the world's largest financial institutions still process millions of transactions daily using COBOL applications running on IBM Mainframes.

In this beginner-friendly tutorial, you'll learn the basics of COBOL, its structure, and how to write your first COBOL program.

What is COBOL?

COBOL stands for:

COmmon Business-Oriented Language

It was designed specifically for:

  • Business applications

  • Financial systems

  • Payroll processing

  • Banking transactions

  • Insurance systems

Why is COBOL Still Important?

  • High reliability

  • Excellent performance

  • Handles massive transaction volumes

  • Used by major banks and government organizations

  • Strong demand for Mainframe professionals

COBOL Program Structure

A COBOL program is divided into four major divisions:

  1. Identification Division

  2. Environment Division

  3. Data Division

  4. Procedure Division

Basic Structure

IDENTIFICATION DIVISION.
PROGRAM-ID. HELLO.

ENVIRONMENT DIVISION.

DATA DIVISION.

PROCEDURE DIVISION.
    DISPLAY "HELLO WORLD".
    STOP RUN.

Understanding Each Division

1. Identification Division

Provides program information.

IDENTIFICATION DIVISION.
PROGRAM-ID. HELLO.

Purpose

  • Program name

  • Documentation

  • Program identification

2. Environment Division

Defines system-related information.

ENVIRONMENT DIVISION.

Examples:

  • Input files

  • Output files

  • Device configurations

For simple programs, this division may remain empty.

3. Data Division

Defines variables and data structures.

Example:

DATA DIVISION.
WORKING-STORAGE SECTION.

01 WS-NAME PIC X(20).
01 WS-AGE PIC 99.

Explanation

StatementMeaning
PIC X(20)Character field of 20 characters
PIC 99Numeric field with 2 digits

4. Procedure Division

Contains executable logic.

PROCEDURE DIVISION.
    DISPLAY "WELCOME TO COBOL".
    STOP RUN.

Your First COBOL Program

IDENTIFICATION DIVISION.
PROGRAM-ID. FIRSTPROG.

PROCEDURE DIVISION.
    DISPLAY "WELCOME TO COBOL PROGRAMMING".
    STOP RUN.

Output

WELCOME TO COBOL PROGRAMMING

Working with Variables

Example:

IDENTIFICATION DIVISION.
PROGRAM-ID. EMPLOYEE.

DATA DIVISION.
WORKING-STORAGE SECTION.

01 WS-NAME PIC X(20).

PROCEDURE DIVISION.
    MOVE "PUNIT" TO WS-NAME
    DISPLAY "EMPLOYEE NAME: " WS-NAME
    STOP RUN.

Output

EMPLOYEE NAME: PUNIT

Performing Calculations

Example:

IDENTIFICATION DIVISION.
PROGRAM-ID. ADDITION.

DATA DIVISION.
WORKING-STORAGE SECTION.

01 NUM1 PIC 999 VALUE 100.
01 NUM2 PIC 999 VALUE 200.
01 RESULT PIC 999.

PROCEDURE DIVISION.
    ADD NUM1 TO NUM2 GIVING RESULT
    DISPLAY "TOTAL = " RESULT
    STOP RUN.

Output

TOTAL = 300

IF Condition Example

Example:

IDENTIFICATION DIVISION.
PROGRAM-ID. RESULT.

DATA DIVISION.
WORKING-STORAGE SECTION.

01 MARKS PIC 999 VALUE 75.

PROCEDURE DIVISION.

    IF MARKS >= 50
       DISPLAY "PASS"
    ELSE
       DISPLAY "FAIL"
    END-IF

    STOP RUN.

Output

PASS

Loop Example (PERFORM)

Example:

IDENTIFICATION DIVISION.
PROGRAM-ID. LOOPTEST.

DATA DIVISION.
WORKING-STORAGE SECTION.

01 WS-COUNT PIC 9 VALUE 1.

PROCEDURE DIVISION.

    PERFORM UNTIL WS-COUNT > 5

       DISPLAY "COUNT = " WS-COUNT

       ADD 1 TO WS-COUNT

    END-PERFORM

    STOP RUN.

Output

COUNT = 1
COUNT = 2
COUNT = 3
COUNT = 4
COUNT = 5

COBOL Data Types

Alphanumeric

PIC X(10)

Example:

PUNIT

Numeric

PIC 999

Example:

123

Decimal

PIC 999V99

Example:

123.45

Common COBOL Verbs

VerbPurpose
MOVEAssign value
ADDAddition
SUBTRACTSubtraction
MULTIPLYMultiplication
DIVIDEDivision
DISPLAYPrint output
ACCEPTRead input
PERFORMLoop/Call paragraph
IFConditional logic

Real-World COBOL Applications

Banking

  • Account processing

  • ATM transactions

  • Loan systems

Insurance

  • Policy management

  • Claims processing

Retail

  • Billing systems

  • Inventory management

Government

  • Tax processing

  • Pension systems

Tips for Beginners

  1. Learn COBOL syntax thoroughly.

  2. Practice simple programs daily.

  3. Understand JCL alongside COBOL.

  4. Learn DB2 basics for database access.

  5. Explore CICS for online transactions.

  6. Study real-world Mainframe applications.

Frequently Asked Questions

Is COBOL still used today?

Yes. Many large organizations continue to rely on COBOL for mission-critical systems.

Is COBOL easy to learn?

Yes. COBOL's syntax is close to English and is considered beginner-friendly.

What should I learn after COBOL?

A recommended Mainframe learning path:

  1. COBOL

  2. JCL

  3. VSAM

  4. DB2

  5. CICS

  6. Mainframe Production Support

Conclusion

COBOL remains one of the most important programming languages in enterprise computing. By learning COBOL, you open opportunities in banking, insurance, government, and Mainframe development.

Start with basic programs, practice regularly, and gradually expand your knowledge into JCL, DB2, and CICS to build a strong Mainframe career.

Punit Kumar Trivedi 1 June 2026
Share this post
Tags
Archive
Sign in to leave a comment