Columns and Areas
Part of the First Programs section of Coddy's COBOL Programming journey. Lesson 5 of 19.
The COBOL in this course is written in fixed format: each column of a line has a job. Columns 1 to 6 stay empty, column 7 is for special marks, and code starts in column 8.
Area A is columns 8 to 11. Division headers, PROGRAM-ID, paragraph names and level numbers 01 and 77 start there. Area B starts at column 12, and statements such as DISPLAY are written there.
PROCEDURE DIVISION.
DISPLAY "In Area B".The compiler ignores anything after column 72, a limit from 80-column punched cards.
The editor draws a line at columns 8, 12 and 72, and Tab moves the cursor from one area to the next.
Challenge
EasyEvery line of this program starts in column 1, so the compiler reads a letter in column 7 as a mark and stops. Move the division and PROGRAM-ID lines to column 8 and the statements to column 12, so it prints In Area B.
Try it yourself
IDENTIFICATION DIVISION.
PROGRAM-ID. AREAS.
PROCEDURE DIVISION.
DISPLAY "In Area B".
STOP RUN.