Skip to main content
Module 1 · Lesson 1 of 21/16 in the course~14 min
Module lessons (1/2)

Program Structure and Columns (1–80)

Explore Stage

Architecture of a COBOL source

Understanding why an 80-column punch card file requires rigorous positional discipline.

COBOL (Common Business-Oriented Language), born in 1959, still powers the majority of the world's banking, insurance and government transactions today. Unlike loosely syntax languages like Python or JavaScript, a classic COBOL program is organized as a formal business document divided into Divisions, Sections, Paragraphs, and Sentences.

1. The fixed 80 column format (Area A vs Area B)

Historically programs were punched onto 80 character IBM cards. Even in modern fixed compilers, the horizontal position determines whether the code compiles or generates errors:

  • Columns 1–6 (Sequence Area): Optional row numbering (e.g. 000100); today left empty with 6 spaces.
  • Column 7 (Indicators Area): Entering * transforms the entire row into a comment; - indicates continuation of literal string; / force skip page while printing.
  • Columns 8–11 (Area A): Reserved for structural headers: DIVISION, SECTION names, paragraph names, FD, and 01 or 77 level data declarations.
  • Columns 12–72 (Area B): Reserved for all executable statements (DISPLAY, MOVE, ADD, IF, PERFORM) and subordinate fields (05, 10, …).
  • Columns 73–80 (Identification Area): Silently ignored by the compiler. Anything above column 72 is cut!
COBOL
000100 IDENTIFICATION DIVISION.
000200 PROGRAM-ID. BANK-BOOT.
      * Commento valido: asterisco esattamente a colonna 7 (6 spazi).
       PROCEDURE DIVISION.
           DISPLAY "Area B: colonna 12 (11 spazi iniziali)".
           STOP RUN.

2. The Four Divisions in strict order

Every COBOL file always follows the same top-down pattern, from the ID card down to the executable statements:

  1. IDENTIFICATION DIVISION. — Contains PROGRAM-ID. and optional metadata (AUTHOR., DATE-WRITTEN.). It is the only one required before PROCEDURE DIVISION.
  2. ENVIRONMENT DIVISION. — Connect the program to the external (CONFIGURATION SECTION, INPUT-OUTPUT SECTION and FILE-CONTROL).
  3. DATA DIVISION. — Declares each byte of program memory (FILE SECTION, WORKING-STORAGE SECTION, LINKAGE SECTION).
  4. PROCEDURE DIVISION. — Contains the executable stream. Must stop with STOP RUN. (or GOBACK.).
COBOL
       IDENTIFICATION DIVISION.
       PROGRAM-ID. PAYROLL-CHECK.
       ENVIRONMENT DIVISION.
       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01 WS-STATUS PIC X(5) VALUE "READY".
       PROCEDURE DIVISION.
           DISPLAY "PAYROLL ENGINE: " WS-STATUS.
           STOP RUN.

3. Modern comments (*>) and the role of the final period (.)

From the COBOL 2002 standard onwards, in addition to the classic * in column 7, the inline comment *> is available, useful at the end of the line in Area B:

COBOL
      * Classico commento full-line (asterisco a col 7)
       PROCEDURE DIVISION.
           DISPLAY "Boot complete."     *> Commento inline COBOL-2002+
           STOP RUN.

In PROCEDURE DIVISION, the period . acts as a sentence-ending "full stop" (period scope terminator):

COBOL
       IDENTIFICATION DIVISION.
       PROGRAM-ID. MULTI-STOP.
       PROCEDURE DIVISION.
           DISPLAY "Step 1"
           DISPLAY "Step 2"
           STOP RUN.

Try it yourself

Exercise#cobol.m1.l1.e1
Attempts: 0Loading…

Write the initial COBOL program headers by entering the IDENTIFICATION DIVISION and defining the program name as HELLO-PRG.

Loading editor…
Show hint

Write IDENTIFICATION DIVISION. in column 8 (7 margin spaces) and at the end PROGRAM-ID. HELLO-PRG.

Solution available after 3 attempts

Exercise#cobol.m1.l1.e2
Attempts: 0Loading…

Complete the skeleton by entering the PROCEDURE DIVISION and print the text 'HELLO COBOL' on the screen using DISPLAY. Remember to stop the program with STOP RUN.

Loading editor…
Show hint

Under DIVISION PROCEDURES, write DISPLAY 'HELLO COBOL'. in column 12 (11 margin spaces) and STOP RUN. on the next line.

Solution available after 3 attempts

Exercise#cobol.m1.l1.e3
Attempts: 0Loading…

Build a complete four-division program (IDENTIFICATION, ENVIRONMENT, DATA, PROCEDURES) with PROGRAM-ID CORE-BOOT, an asterisk (*) comment in column 7, and a final print DISPLAY 'SYSTEM READY'.

Loading editor…
Show hint

Put a comment with 6 spaces + '*', the four divisions at 7 spaces (column 8) and DISPLAY + STOP RUN at 11 spaces (column 12).

Solution available after 3 attempts

COBOL Quiz#cobol.m1.l1.e4
Ready

What is the effect of this COBOL fixed format line (11 leading spaces before DISPLAY)?

COBOL
       IDENTIFICATION DIVISION.
       PROGRAM-ID. CHECK-COL.
       PROCEDURE DIVISION.
       DISPLAY "ERRORE DI AREA".
           STOP RUN.
Answer options
COBOL Quiz#cobol.m1.l1.e5
Ready

What happens during compilation if a line of COBOL code exceeds column 72 in the classic fixed format?

COBOL
           DISPLAY "MESSAGGIO LUNGHISSIMO CHE ESCE OLTRE SETTANTADUE QUI!"
Answer options