codegurukool.com · Free coding tutorials & online compiler

Home › COBOL Tutorial › COBOL program structure

COBOL program structure

Four divisions, in a fixed order.

Every program has up to four divisions: IDENTIFICATION DIVISION (names the program), ENVIRONMENT DIVISION (files and computer setup), DATA DIVISION (variables) and PROCEDURE DIVISION (the instructions). Variables live in the WORKING-STORAGE SECTION. Every sentence ends with a period.

Example code

       IDENTIFICATION DIVISION.
       PROGRAM-ID. DIVS.
       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01 WS-MSG PIC X(14) VALUE "Four divisions".
       PROCEDURE DIVISION.
           DISPLAY WS-MSG.
           STOP RUN.

Run this code in the online editor

← COBOL get startedCOBOL format and comments →