typestar

The program shape in COBOL

The smallest COBOL program: two divisions, two sentences, and a full stop on each.

*> The smallest COBOL program: two divisions and a full stop.
IDENTIFICATION DIVISION.
PROGRAM-ID. HELLO-PROGRAM.
PROCEDURE DIVISION.
    DISPLAY "Gull Rock light: keeper on duty".
    DISPLAY "Visitors welcome at low tide".
    STOP RUN.

How it works

  1. IDENTIFICATION DIVISION. and PROGRAM-ID. name the program; every sentence ends in a period.
  2. PROCEDURE DIVISION. is where statements live; DISPLAY prints a line.
  3. STOP RUN. hands control back to the operating system.

Keywords and builtins used here

The run, in numbers

Lines
7
Characters to type
226
Tokens
20
Three-star pace
45 tpm

At the three-star pace of 45 tokens a minute, this run takes about 27 seconds.

Type this snippet

Step 1 of 3 in The program shape, step 1 of 27 in Language basics.

Next →

The program shape in other languages