You are on page 1of 20

| 

  
à  
    
         
  
         
 
 ! "

 # !$ %    
   
&'()* &'+,  &')-
 .   
       
      !$ %/%    

±   0 


1   *  
   
23           


  
       *   !

  *   *         
 
!
 
0
4  

 
 
       
           
!  !  

 5     


    
     ï  


 5 *  '-6      


    


 % &''' 7     -86   


              
 

   

 #    


 $  
 $    
 $     
 2   13  
 5           *  
        
  
   
   

  
       9
          
  

 #      ð   




     

 #  ,               


       :     
   
 

 !      


    ! 
   
# :          ! * 
   ;

 ð à  ð!     


         

 !"  ð!       


         
   
 
 ð  ð!          
   

 " à ð" ð!       


        !#! %<% %$ %
          

   
 
#
        
       $
#
 
%9$#%5%!#%$ %<% %$   0=9±=9
%<% %$
|> 9?
000100 K KKK K K
Kr
000200 PROGRAM-IDr HELLOWORLDr
000300
000400  K   K K
K
000500 CONFIGURATION SECTIONr
000600 SOURCE-COMPUTERr RM-COBOLr
000700 OBJECT-COMPUTERr RM-COBOLr
000800
000900  K K
Kr
001000 FILE SECTIONr
001100
101200     K K
Kr
101300
101400 MAIN-LOGIC SECTIONr
101500 DISPLAY "Hello world!"
101600 STOP RUNr
 #   

 
     
%  
*      
 
  ?/ 
 
     ;
!  
!     
! 0  

 01 GrossPay PIC 9(5)V99 VALUE ZEROS.


7 %

7     


:   
#            
 
±           
 
#            

 01 DateOfBirth.
02 DayOfBirth PIC 99.
02 MonthOfBirth PIC 99.
02 YearOfBirth PIC 9(2).
  
ADD R ÄO GIVING 
SUBÄRACÄ R FROM GIVING 
MULÄIPLY R BY GIVING 
DIVIDE R INÄO GIVING 
COMPUÄE R+ * 
MOVE RÄO 
SORÄ 

ON ASCENDING KEY 
USING  

GIVING  
 

   
MERGE O


ON ASCENDING KEY 
USING 
 

GIVING  


DISPLAY  R
 .
Accept  

PERFORM RRRROÄ ROUG paragraphname2


VARYING  FROM R  BY R 
UNÄIL  
   
?

000010 K KKK K K
K.
000020 PROGRAM-ID. SAMPLE.
000030 AUÄ OR. J.P.E. ODGSON.
000040 DAÄE-WRIÄÄEN. 4 February 2000
000041
000042* A sample program just to show the form.
000043* Ähe program copies its input to the output,
000044* and counts the number of records.
000045* At the end this number is printed.
000046
   
? 
000050  K   K K
K.
000060 INPUÄ-OUÄPUÄ SECÄION.
000070 FILE-CONÄROL.
000080 SELECÄ SÄUDENÄ-FILE ASSIGN ÄO SYSIN
000090 ORGANIZAÄION IS LINE SEQUENÄIAL.
000100 SELECÄ PRINÄ-FILE ASSIGN ÄO SYSOUÄ
000110 ORGANIZAÄION IS LINE SEQUENÄIAL.
000120
000130  K K
K.
000140 FILE SECÄION.
000150 FD SÄUDENÄ-FILE
000160 RECORD CONÄAINS 43 C ARACÄERS
000170 DAÄA RECORD IS SÄUDENÄ-IN.
000180 01 SÄUDENÄ-IN PIC X(43).
 
? 
000190
000200 FD PRINÄ-FILE
000210 RECORD CONÄAINS 80 C ARACÄERS
000220 DAÄA RECORD IS PRINÄ-LINE.
000230 01 PRINÄ-LINE PIC X(80).
000240
000250 WORKING-SÄORAGE SECÄION.
000260 01 DAÄA-REMAINS-SWIÄC PIC X(2) VALUE SPACES.
000261 01 RECORDS-WRIÄÄEN PIC 99.
000270
000280 01 DEÄAIL-LINE.
000290 05 FILLER PIC X(7) VALUE SPACES.
000300 05 RECORD-IMAGE PIC X(43).
000310 05 FILLER PIC X(30) VALUE SPACES.
000311
 
? 
000312 01 SUMMARY-LINE.
000313 05 FILLER PIC X(7) VALUE SPACES.
000314 05 ÄOÄAL-READ PIC 99.
000315 05 FILLER PIC X VALUE SPACE.
000316 05 FILLER PIC X(17) VALUE 'Records were read'.
000318 05 FILLER PIC X(53) VALUE SPACES.
000319
000320 È   K K
K
000330 PREPARE-SENIOR-REPORÄ.
000340 OPEN INPUÄ SÄUDENÄ-FILE.
000350 OUÄPUÄ PRINÄ-FILE.
000351 MOVE ZERO ÄO RECORDS-WRIÄÄEN.
000360 READ SÄUDENÄ-FILE
000370 AÄ END MOVE 'NO' ÄO DAÄA-REMAINS-SWIÄC .
000380 END-READ.
 
? 
000390 PERFORM PROCESS-RECORDS
000410 UNÄIL DAÄA-REMAINS-SWIÄC = 'NO'.
000411 PERFORM PRINÄ-SUMMARY.
000420 CLOSE SÄUDENÄ-FILE.
000430 PRINÄ-FILE.
000440 SÄOP RUN.
000450
000460 PROCESS-RECORDS.
000470 MOVE SÄUDENÄ-IN ÄO RECORD-IMAGE.
000480 MOVE DEÄAIL-LINE ÄO PRINÄ-LINE.
000490 WRIÄE PRINÄ-LINE.
000500 ADD 1 ÄO RECORDS-WRIÄÄEN.
000510 READ SÄUDENÄ-FILE
000520 AÄ END MOVE 'NO' ÄO DAÄA-REMAINS-SWIÄC
000530 END-READ.
 
? 
000540
000550 PRINÄ-SUMMARY.
000560 MOVE RECORDS-WRIÄÄEN ÄO ÄOÄAL-READ.
000570 MOVE SUMMARY-LINE ÄO PRINÄ-LINE.
000571 WRIÄE PRINÄ-LINE.
000572
000580