Loading

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’.

----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
       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.                          
           GOBACK.

Output of this program will be

HELLO WORLD !

Related Posts




blog comments powered by Disqus

There's 0 Comment So Far

Share your thoughts, leave a comment!