COBOL–Working storage variables

Working Storage section comes under DATA division. Different datatypes of COBOL are explained here.

Below sample cobol program declares and Displays a working storage variable named ‘MY-STRING’.

       IDENTIFICATION DIVISION.                        
       PROGRAM-ID.    KARTEST3.                        
      * define and use a working storage variable      
       ENVIRONMENT DIVISION.                           
       DATA DIVISION.                                  
       WORKING-STORAGE SECTION.                        
        01 MY-STRING  PIC X(20) VALUE 'HELLO WORLD ! '.
       PROCEDURE DIVISION.                             
           DISPLAY MY-STRING.                          

Output of this program will be


Leave a Reply

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

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

Google photo

You are commenting using your Google 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.