COBOL Program Structure
A COBOL program is organized as a strict hierarchy: DIVISIONS contain SECTIONS, sections contain PARAGRAPHS, and paragraphs contain one or more SENTENCES, each terminated by a period. This is unlike block-scoped languages such as Java or Python where curly braces or indentation define scope; in COBOL, structure comes from named, ordered units that must appear in a fixed sequence: IDENTIFICATION DIVISION, ENVIRONMENT DIVISION, DATA DIVISION, and PROCEDURE DIVISION. Understanding this hierarchy is essential before writing any real program, because misplacing a paragraph in the wrong division, or forgetting a required period, is one of the most common sources of compile errors for beginners.
Cricket analogy: Just as a Test match is structured into innings, then overs, then individual deliveries, a COBOL program is structured into divisions, then sections, then paragraphs, then sentences, each nested inside the last.
Divisions, Sections, Paragraphs, and Sentences
A SECTION is an optional grouping within a division, declared with a name followed by the word SECTION and a period, for example FILE-CONTROL SECTION within ENVIRONMENT DIVISION. A PARAGRAPH is a user-named block of executable or declarative code, such as 100-CALCULATE-TOTALS, and a SENTENCE is one or more STATEMENTS (like MOVE, ADD, or PERFORM) ending in a period. Modern structured COBOL relies heavily on the PERFORM verb to call paragraphs like subroutines, for example PERFORM 100-CALCULATE-TOTALS, which lets programmers build modular, readable control flow instead of relying on the older, discouraged GO TO statement.
Cricket analogy: A named paragraph like 100-CALCULATE-TOTALS called via PERFORM is like a captain calling for a specific fielding drill, 'Slip catching practice', a named, reusable unit of action rather than one-off improvisation.
Fixed-Format Coding Columns
Traditional COBOL source files follow a fixed-format layout inherited from 80-column punch cards: columns 1-6 are reserved for optional sequence numbers, column 7 is the indicator area (an asterisk marks a comment line, a hyphen continues a literal), columns 8-11 form Area A (where division, section, and paragraph names must start), and columns 12-72 form Area B (where most statements are written). Columns 73-80 were historically reserved for identification text and are ignored by the compiler. Modern compilers like GnuCOBOL still support this fixed format by default, though many now also support a more flexible free-format mode enabled with a compiler directive.
Cricket analogy: Just as a scorebook has a fixed column for overs and a separate fixed column for runs that a scorer cannot mix up, COBOL enforces separate fixed columns: Area A (8-11) for division names and Area B (12-72) for statements.
* Columns: 1-6 seq | 7 indicator | 8-11 Area A | 12-72 Area B
IDENTIFICATION DIVISION.
PROGRAM-ID. STRUCTURE-DEMO.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 WS-TOTAL PIC 9(5) VALUE ZERO.
PROCEDURE DIVISION.
100-MAIN-PARA.
PERFORM 200-CALCULATE-TOTALS.
DISPLAY "Total is: " WS-TOTAL.
STOP RUN.
200-CALCULATE-TOTALS.
ADD 10 TO WS-TOTAL.Paragraph names like 100-MAIN-PARA or 200-CALCULATE-TOTALS are a naming convention, not a compiler requirement. Many shops use numeric prefixes in increments of 10 or 100 so new paragraphs can be inserted between existing ones without renumbering everything.
Forgetting the period at the end of a paragraph name or a sentence is one of the most common beginner errors and can cause the compiler to merge two paragraphs into one, producing confusing 'undefined paragraph' errors elsewhere in PERFORM statements.
- COBOL structure is hierarchical: DIVISIONS contain SECTIONS, which contain PARAGRAPHS, which contain SENTENCES.
- The four divisions must appear in a fixed order: IDENTIFICATION, ENVIRONMENT, DATA, PROCEDURE.
- A sentence is one or more statements (MOVE, ADD, PERFORM, etc.) ending in a period.
- PERFORM calls a named paragraph like a subroutine, enabling modular control flow over old-style GO TO.
- Traditional fixed-format source uses columns 1-6 for sequence numbers, column 7 for indicators, Area A (8-11) for division/section/paragraph names, and Area B (12-72) for statements.
- Modern compilers like GnuCOBOL also support a free-format mode via a compiler directive.
- Missing periods are a frequent source of confusing compile errors for beginners.
Practice what you learned
1. What is the correct hierarchy of COBOL program structure, from largest to smallest?
2. In fixed-format COBOL source, where must division and paragraph names begin?
3. What character in column 7 marks a line as a comment in fixed-format COBOL?
4. What verb is used to call a named paragraph as a reusable unit of logic?
5. What terminates a COBOL sentence?
Was this page helpful?
You May Also Like
What Is COBOL?
An introduction to COBOL, the business-oriented programming language that still powers banking, insurance, and government systems worldwide.
The Four Divisions Explained
A detailed walkthrough of COBOL's four mandatory divisions — IDENTIFICATION, ENVIRONMENT, DATA, and PROCEDURE — and what belongs in each.
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