COBOL – Hello World program

Below sample cobol program has the minimal set of statements required. It contains all the four divisions and PROGRAM-ID is a mandatory statement which will have the program name.

IDENTIFICATION DIVISION
ENVIRONMENT DIVISION        
DATA DIVISION              
PROCEDURE DIVISION

Divisions – > Section –> Paragraph –> Statement.

----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
       IDENTIFICATION DIVISION. 
       PROGRAM-ID.    KARTEST2. 
       ENVIRONMENT DIVISION. 
       DATA DIVISION. 
       PROCEDURE DIVISION. 
           DISPLAY 'HELLO WORLD ! ' .
           GOBACK.

Output of this program will be

HELLO WORLD !
Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.