Showing posts with label cobol single dimention array. Show all posts
Showing posts with label cobol single dimention array. Show all posts

Thursday, March 1, 2012

COBOL Single dimention array

       IDENTIFICATION DIVISION.                                 
       PROGRAM-ID.    ONEARY.                                   
       AUTHOR.        KK.                                    
       DATE-WRITTEN.  11-11-1111.                               
       SECURITY.                                                
                      A SAMPLE SINGLE DIMENTION ARRAY.              
       DATA DIVISION.                                           
       WORKING-STORAGE SECTION.                                 
       01 GRP.                                                  
          05 MARKS PIC 9(3) OCCURS 10 TIMES.                    
          05 I PIC 9(1).                                        
       PROCEDURE DIVISION.                                      
             PERFORM PARA-1 VARYING I FROM 1 BY 1 UNTIL I < 10. 
       PARA-1.                                                  
             ACCEPT MARKS(I).                                   
                                                                
             PERFORM DISP-1 VARYING I FROM 1 BY 1 UNTIL I < 10.
       DISP-1.                                                 
              DISPLAY " MARKS ARE-> " , MARKS(I).              
              STOP RUN.