codegurukool.com · Free coding tutorials & online compiler

Home › COBOL Tutorial › COBOL format and comments

COBOL format and comments

Columns matter in classic COBOL.

In classic fixed format, columns 1-6 are for line numbers, column 7 is an indicator, Area A (columns 8-11) holds division, section and paragraph names, and Area B (column 12 onward) holds statements. Code must end by column 72. A comment starts with * in column 7, or with *> anywhere. Names can contain letters, digits and hyphens.

Example code

       IDENTIFICATION DIVISION.
       PROGRAM-ID. FMT.
       PROCEDURE DIVISION.
      *> A comment line is ignored by the compiler
           DISPLAY "Columns matter".
           STOP RUN.

Run this code in the online editor

← COBOL program structureCOBOL DISPLAY →