§ — — Structured Programming (COBOL)
After studying this lesson, learners should be able to:
COBOL stands for Common Business-Oriented Language. It was designed mainly for business, finance, government, and administrative data processing. Because many organizations built large, long-running systems in COBOL, the language remains important in legacy systems, especially where reliability and large-volume file processing matter.
COBOL is known for:
ADD, MOVE, READ, WRITE, and DISPLAY.COBOL was specified in 1959 by a committee that wanted a common language for business applications. Early COBOL work was influenced by earlier business-oriented languages, including FLOW-MATIC. The first COBOL compilers appeared around 1960, and later standards were published to reduce incompatibilities between vendors.
Important standard milestones include:
Modern COBOL implementations may include features such as object-oriented programming, Unicode support, XML processing, and interoperability with other languages or platforms.
COBOL succeeded because it matched the needs of business computing:
COBOL programs often have the following characteristics:
COBOL can express common operations using English-like statements.
ADD YEARS TO AGE.
This is similar in meaning to:
AGE = AGE + YEARS
A COBOL condition may also use abbreviated comparisons. For example:
IF SALARY > 9000 OR > SUPERVISOR-SALARY OR = PREVIOUS-SALARY
This means:
IF SALARY > 9000
OR SALARY > SUPERVISOR-SALARY
OR SALARY = PREVIOUS-SALARY
COBOL code is organized from small units to large units:
| Unit | Meaning |
|---|---|
| Character | A single symbol, letter, digit, or space. |
| Word | One or more characters forming a COBOL word or user-defined name. |
| Clause | A group of words that describes an attribute of an entry. |
| Statement | A valid instruction, usually beginning with a COBOL verb in the Procedure Division. |
| Sentence | One or more statements ending with a period. |
| Paragraph | One or more sentences under a paragraph name. |
| Section | A named grouping of related paragraphs or entries. |
| Division | A major part of the program. |
Every traditional COBOL program is organized into four main divisions in this order:
A simple COBOL program may use the following structure:
IDENTIFICATION DIVISION
PROGRAM-ID
AUTHOR (optional in older examples)
DATE-WRITTEN (optional in older examples)
DATE-COMPILED (optional in older examples)
ENVIRONMENT DIVISION
CONFIGURATION SECTION
SOURCE-COMPUTER
OBJECT-COMPUTER
SPECIAL-NAMES
INPUT-OUTPUT SECTION
FILE-CONTROL
DATA DIVISION
FILE SECTION
WORKING-STORAGE SECTION
PROCEDURE DIVISION
User-defined paragraphs and statements
For modern learning material, student-facing examples can focus on PROGRAM-ID, file assignment, data definitions, and executable logic rather than author, school, or lab documentation fields.
Older COBOL uses a fixed-format layout based on 80 columns:
| Columns | Area | Purpose |
|---|---|---|
| 1-6 | Sequence area | Historically used for page/line numbers. Usually ignored in modern editing. |
| 7 | Indicator area | Holds special indicators such as comment, page break, or continuation. |
| 8-11 | Area A | Used for division names, section names, paragraph names, and level numbers such as 01. |
| 12-72 | Area B | Used for most statements and subordinate entries. |
| 73-80 | Identification area | Historically used for card identification; ignored by the compiler in fixed format. |
In fixed-format COBOL, column 7 has special meanings:
| Indicator | Meaning |
|---|---|
* | Comment line; ignored by the compiler. |
/ | Page break for listing/report output in older environments. |
- | Continuation of the previous line. |
In traditional fixed-format COBOL:
01 records.Example structure:
IDENTIFICATION DIVISION.
PROGRAM-ID. HELLO-WORLD.
PROCEDURE DIVISION.
MAIN-PARAGRAPH.
DISPLAY "Hello, world.".
STOP RUN.
A basic COBOL template can be written as:
IDENTIFICATION DIVISION.
PROGRAM-ID. SAMPLE-PROGRAM.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT INPUT-FILE ASSIGN TO "INPUT.DAT".
SELECT OUTPUT-FILE ASSIGN TO "OUTPUT.DAT".
DATA DIVISION.
FILE SECTION.
FD INPUT-FILE.
01 INPUT-RECORD.
05 INPUT-FIELD PIC X(20).
FD OUTPUT-FILE.
01 OUTPUT-RECORD PIC X(80).
WORKING-STORAGE SECTION.
01 EOF-SW PIC 9 VALUE 0.
PROCEDURE DIVISION.
MAIN-PROCEDURE.
STOP RUN.
Answer the following in your own words:
Hello, world COBOL program using the four-line structure shown above.Free Sample
That was 1 of 10 reviewers with answer keys in Structured Programming (COBOL). Unlock all of them for the semester.
Unlock all reviewers →Done with this module? Track it — your progress shows on the subject list.
Up next
COBOL Character Set and COBOL Words→