Reading — step 1 of 5
Learn
~1 min readStructure and Output
COBOL (COmmon Business-Oriented Language) was designed in 1959 by a committee chaired by Grace Hopper. The goal: a programming language readable by managers. The result: programs that look like business letters.
IDENTIFICATION DIVISION.
PROGRAM-ID. HELLO.
PROCEDURE DIVISION.
DISPLAY "Hello, COBOL!".
STOP RUN.
Critical: column rules. In fixed-format COBOL (GnuCOBOL's default):
- Columns 1-6: line numbers (often blank)
- Column 7: comment marker (
*for comment line) - Columns 8-11: Area A — division/section/paragraph names
- Columns 12-72: Area B — actual code
The leading 7 spaces matter. Get them wrong and the compiler errors.
Divisions (mandatory order):
- IDENTIFICATION — names the program
- ENVIRONMENT — system info (often empty)
- DATA — variable declarations
- PROCEDURE — the actual code
Statements end with . (period). Most are written in upper case by convention.
Discussion
Ask a question, share an insight, or help someone who’s stuck.
Sign in to post a comment or reply.
Loading…