The Four Divisions Explained
Every COBOL program must contain exactly four divisions in a fixed order: IDENTIFICATION DIVISION, ENVIRONMENT DIVISION, DATA DIVISION, and PROCEDURE DIVISION. Each division answers a different question: IDENTIFICATION says what the program is, ENVIRONMENT says where it runs and what external resources (like files) it uses, DATA says what data it works with, and PROCEDURE says what it actually does step by step. This separation of concerns, decades before the term became fashionable in software engineering, is what lets a COBOL maintainer jump straight to the DATA DIVISION to check a field's size without wading through business logic.
Cricket analogy: Just as a player's ICC profile separates biographical info, playing conditions, career stats, and match actions into distinct sections, COBOL's four divisions separate program identity, environment, data, and logic just as cleanly.
IDENTIFICATION DIVISION
The IDENTIFICATION DIVISION is the mandatory first division and, at minimum, requires a PROGRAM-ID paragraph naming the program, for example PROGRAM-ID. PAYROLL-CALC. Older COBOL standards also allowed optional documentation paragraphs like AUTHOR, DATE-WRITTEN, and INSTALLATION, though these were deprecated starting with COBOL 2002 and modern compilers like GnuCOBOL now typically ignore or warn on them. The PROGRAM-ID value matters functionally, not just cosmetically: it becomes the compiled module's external name, which is how other programs reference it in a CALL statement.
Cricket analogy: Just as a scorecard must open with the match's official title, say 'India vs Australia, 3rd Test', before any play is recorded, COBOL's IDENTIFICATION DIVISION must open with PROGRAM-ID naming the program before anything else.
ENVIRONMENT DIVISION
The ENVIRONMENT DIVISION, though optional in many modern programs that don't use files, traditionally contains two sections: CONFIGURATION SECTION, which can specify the source and object computer, and INPUT-OUTPUT SECTION, which contains FILE-CONTROL paragraphs mapping logical file names used in the program to physical files or datasets on disk, using the SELECT ... ASSIGN TO clause. For example, SELECT CUSTOMER-FILE ASSIGN TO "CUSTDATA.DAT" links the internal name CUSTOMER-FILE to an actual file path, and this indirection is what lets the same COBOL program run against different physical file locations on different systems without changing the PROCEDURE DIVISION logic.
Cricket analogy: Just as a match's ENVIRONMENT (venue, pitch report, weather) is specified separately from the players and the play-by-play, COBOL's ENVIRONMENT DIVISION separately declares file locations via SELECT ... ASSIGN TO before any logic runs.
DATA DIVISION and PROCEDURE DIVISION
The DATA DIVISION declares every piece of data the program will use, most commonly within the WORKING-STORAGE SECTION for program variables and the FILE SECTION for record layouts tied to files declared in ENVIRONMENT DIVISION; each item is defined with a level number (01 for a group, 05/10/etc. for subordinate fields) and a PIC clause. The PROCEDURE DIVISION contains the actual executable logic, written as paragraphs of sentences using verbs like MOVE, ADD, SUBTRACT, IF, PERFORM, READ, WRITE, and STOP RUN, and it is the only division where business rules are expressed; DATA DIVISION describes the nouns of the program while PROCEDURE DIVISION describes the verbs.
Cricket analogy: Just as a team roster (DATA) lists every player with role and stats before a single ball is bowled (PROCEDURE), COBOL's DATA DIVISION declares every field with a PIC clause before PROCEDURE DIVISION executes any logic.
IDENTIFICATION DIVISION.
PROGRAM-ID. FOUR-DIVISIONS-DEMO.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT CUSTOMER-FILE ASSIGN TO "CUSTDATA.DAT"
ORGANIZATION IS LINE SEQUENTIAL.
DATA DIVISION.
FILE SECTION.
FD CUSTOMER-FILE.
01 CUSTOMER-RECORD.
05 CUST-ID PIC 9(6).
05 CUST-NAME PIC X(30).
WORKING-STORAGE SECTION.
01 WS-EOF-FLAG PIC X VALUE "N".
PROCEDURE DIVISION.
100-MAIN-PARA.
OPEN INPUT CUSTOMER-FILE.
PERFORM UNTIL WS-EOF-FLAG = "Y"
READ CUSTOMER-FILE
AT END MOVE "Y" TO WS-EOF-FLAG
NOT AT END DISPLAY CUST-NAME
END-READ
END-PERFORM.
CLOSE CUSTOMER-FILE.
STOP RUN.A useful mental shortcut: IDENTIFICATION answers 'what is this program?', ENVIRONMENT answers 'where does it run and what files does it touch?', DATA answers 'what does it work with?', and PROCEDURE answers 'what does it do?'
The four divisions must appear in this exact order — IDENTIFICATION, ENVIRONMENT, DATA, PROCEDURE. Reordering them, or placing a paragraph like PROGRAM-ID after DATA DIVISION, is a fatal compile-time error, not a warning.
- The four mandatory divisions are IDENTIFICATION, ENVIRONMENT, DATA, and PROCEDURE, always in that order.
- IDENTIFICATION DIVISION requires at minimum a PROGRAM-ID paragraph naming the program.
- ENVIRONMENT DIVISION's INPUT-OUTPUT SECTION maps logical file names to physical files via SELECT...ASSIGN TO.
- DATA DIVISION declares data using level numbers (01, 05, etc.) and PIC clauses, typically in WORKING-STORAGE or FILE SECTION.
- PROCEDURE DIVISION contains the executable logic: paragraphs of sentences using verbs like MOVE, ADD, IF, PERFORM.
- DATA DIVISION represents the program's nouns; PROCEDURE DIVISION represents its verbs.
- PROGRAM-ID becomes the module's external name, used by other programs in a CALL statement.
Practice what you learned
1. Which division must contain a PROGRAM-ID paragraph?
2. Which clause maps a logical file name to a physical file in the ENVIRONMENT DIVISION?
3. Where are program variables typically declared for use throughout a COBOL program?
4. Which division contains the actual executable business logic?
5. What happens if the four COBOL divisions are placed out of order?
Was this page helpful?
You May Also Like
COBOL Program Structure
How a COBOL source file is organized into divisions, sections, paragraphs, and sentences, plus the classic fixed-format column layout.
What Is COBOL?
An introduction to COBOL, the business-oriented programming language that still powers banking, insurance, and government systems worldwide.
Your First COBOL Program
Write, compile, and run a complete Hello World COBOL program, and learn the most common mistakes beginners make along the way.
Related Reading
Related Study Notes in Programming
Browse all study notesApache Spark Study Notes
Programming · 30 topics
ProgrammingApache Flink Study Notes
Programming · 30 topics
ProgrammingHadoop Study Notes
Programming · 30 topics
ProgrammingSnowflake Study Notes
Programming · 30 topics
ProgrammingApache Airflow Study Notes
Programming · 30 topics
Programmingdbt (Data Build Tool) Study Notes
Programming · 30 topics