COBOL Program Structure: The Four Divisions
COBOL Fundamentals
Chapter 2 · COBOL Program Structure: The Four Divisions
Chapter 1's own "Hello, World" example already showed the shape every COBOL program follows: four named divisions, in a fixed real order. This chapter covers what each one actually does — and the real, distinctive column layout that governs exactly where each line of COBOL is allowed to start.
The Real Column Layout
Traditional COBOL source code is fixed-format — a real, direct legacy of the punch-card era, where each physical column on a card had a fixed real meaning.
| Columns | Real Purpose |
|---|---|
| 1–6 | Sequence number area — originally card/line numbers; ignored by the compiler today |
| 7 | Indicator area — * or / for a comment line, - for continuation, D for debug lines |
| 8–11 | Area A — DIVISION/SECTION headers, procedure (paragraph) headers, and level numbers 01 and 77 |
| 12–72 | Area B — everything else |
| 73+ | Program name area — historically extended to column 80 on physical punch cards |
*> instead of column 7's indicator, and a >>PAGE directive replaces the old / page-break indicator. Fixed-format remains extremely common in real legacy code, which is why this course teaches it as the default.
IDENTIFICATION DIVISION
The one real, required entry here is PROGRAM-ID, naming the program — already used in Chapter 1's own example. Older COBOL also supported several optional documentation-only paragraphs (AUTHOR, INSTALLATION, DATE-WRITTEN among them), historically useful for recording who wrote a program and when; these were later removed from the standard, and PROGRAM-ID is genuinely the only entry a modern program needs here.
ENVIRONMENT DIVISION
This division describes real, machine-dependent details — everything the program needs to know about the system it runs on, split into two real sections:
CONFIGURATION SECTION
Real, variable features like currency signs, locale, and character sets.
INPUT-OUTPUT SECTION
Real, file-related information — the FILE-CONTROL entries that Chapter 8's own file-handling material builds on directly.
DATA DIVISION
This is where every piece of data a program works with gets described — real COBOL splits it into six possible sections, though most programs (including everything in this Fundamentals course) only need the first two:
WORKING-STORAGE SECTION
Static, program-owned variables — the section used constantly throughout this course.
FILE SECTION
Record layouts for files the program reads or writes — Chapter 8's own territory.
LINKAGE SECTION
Parameters and return values passed between programs — Chapter 9's own real CALL material.
LOCAL-STORAGE, REPORT & SCREEN
Real, more specialized sections — automatic (reentrant) variables, structured report layouts (COBOL Intermediate/Advanced Chapter 5), and interactive screen definitions (COBOL Intermediate/Advanced Chapter 7).
PROCEDURE DIVISION
This is where the real, executable logic lives — organized into named paragraphs (and, in larger programs, sections grouping paragraphs together), each of which can act as a real label or a simple subroutine. Chapter 5's own real PERFORM verb is exactly how one paragraph invokes another, the closest COBOL comes to a function call within a single program.
Putting It Together: A Real, Slightly Expanded Example
Notice WS-GREETING is declared once, in WORKING-STORAGE (DATA DIVISION), then simply referenced by name in PROCEDURE DIVISION — the exact real split FLOW-MATIC first introduced, covered back in Chapter 1. Chapter 3 covers exactly what PIC X(20) means and why.
Hands-On Exercises
Using this chapter's own real column-layout table, explain in your own words why PROGRAM-ID. must start in Area A, while a line like DISPLAY WS-GREETING. must start in Area B.
A colleague says, "The DATA DIVISION and the PROCEDURE DIVISION are really just two halves of the same thing." Using this chapter's own real material, explain in your own words why they actually serve two genuinely different, separate purposes.
📄 View solutionUsing this chapter's own real material on the DATA DIVISION's six sections, explain in your own words which two this Fundamentals course focuses on, and name one real, later chapter each of the remaining sections connects to.
📄 View solutionChapter 2 Quick Reference
- Fixed-format columns: 1–6 sequence, 7 indicator, 8–11 Area A (headers, 01/77 levels), 12–72 Area B (everything else); COBOL 2002 also allows free-format
- IDENTIFICATION DIVISION — PROGRAM-ID is the one real required entry
- ENVIRONMENT DIVISION — CONFIGURATION SECTION (locale/currency) + INPUT-OUTPUT SECTION (files)
- DATA DIVISION — six real sections; this course focuses on WORKING-STORAGE and FILE, with LINKAGE, LOCAL-STORAGE, REPORT, and SCREEN covered or referenced later
- PROCEDURE DIVISION — real, executable paragraphs; PERFORM (Chapter 5) invokes one from another