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
IDENTIFICATION DIVISION.andPROGRAM-ID.name the program; every sentence ends in a period.PROCEDURE DIVISION.is where statements live;DISPLAYprints a line.STOP RUN.hands control back to the operating system.
Keywords and builtins used here
DISPLAYDIVISIONIDENTIFICATIONPROCEDURESTOP
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.
Step 1 of 3 in The program shape, step 1 of 27 in Language basics.