Example of DIVIDE verb

PROGRAM

IDENTIFICATION DIVISION.                                         
PROGRAM-ID. PGM007.                                              
AUTHOR. MAINFRAMEWIZARD.                                         DATA DIVISION.                                                   WORKING-STORAGE   SECTION.                                       

01 NUM1  PIC 9(3) VALUE 05.                                      

01 NUM2  PIC 9(3) VALUE 25.                                      
01 NUM3  PIC 9(3) VALUE 12.                                      
01 NUM4  PIC 9(3) VALUE 60.                                      
01 NUM5  PIC 9(3) VALUE 50.                                      
01 NUM6  PIC 9(3) VALUE 45.                                      
01 NUM7  PIC 9(3) VALUE 09.                                      
01 NUM8  PIC 9(3) VALUE 35.                                      
01 NUM9  PIC 9(3) VALUE 30.                                      
01 NUM10 PIC 9(3) VALUE 25.                                      
01 NUM11 PIC 9(3) VALUE 04.                                      
01 NUM12 PIC 9(3) VALUE 15.                                      
01 NUM14 PIC 9(3) VALUE 05.                                      
01 GROUP1.                                                       
   05 ELEMENT1 PIC 9(3) VALUE 25.                                
   05 ELEMENT2 PIC 9(3) VALUE 36.                                
01 GROUP2.                                                       
   05 ELEMENT3 PIC 9(3) VALUE 05.                                
   05 ELEMENT4 PIC 9(3) VALUE 06.                                                                                                 PROCEDURE DIVISION.                                              

10000-MAIN-PARA.                                                 

                                                                 

     DISPLAY ‘DIVIDE NUM1 INTO NUM2’                             

     DISPLAY ‘NUM1 BEFORE =’ NUM1                                
     DISPLAY ‘NUM2 BEFORE =’ NUM2                                
     DIVIDE NUM1 INTO NUM2                                       
     DISPLAY ‘NUM1 AFTER  =’ NUM1                                
     DISPLAY ‘NUM2 AFTER  =’ NUM2                                     DISPLAY ‘————————–‘                                                                                         

     DISPLAY ‘DIVIDE NUM3 INTO NUM4 GIVING NUM5’                 

     DISPLAY ‘NUM3 BEFORE =’ NUM3                                
     DISPLAY ‘NUM4 BEFORE =’ NUM4                                
     DISPLAY ‘NUM5 BEFORE =’ NUM5                                
     DIVIDE NUM3 INTO NUM4 GIVING NUM5                           
     DISPLAY ‘NUM3 AFTER  =’ NUM3                                
     DISPLAY ‘NUM4 AFTER  =’ NUM4                                
     DISPLAY ‘NUM5 AFTER  =’ NUM5                                     DISPLAY ‘————————–‘                                                                                         

     DISPLAY ‘DIVIDE NUM6 BY NUM7 GIVING NUM8, NUM9’             

     DISPLAY ‘NUM6 BEFORE =’ NUM6                                
     DISPLAY ‘NUM7 BEFORE =’ NUM7                                
     DISPLAY ‘NUM8 BEFORE =’ NUM8                                
     DISPLAY ‘NUM9 BEFORE =’ NUM9                                
     DIVIDE NUM6 BY NUM7 GIVING NUM8, NUM9                       
     DISPLAY ‘NUM6 AFTER  =’ NUM6                                
     DISPLAY ‘NUM7 AFTER  =’ NUM7                                
     DISPLAY ‘NUM8 AFTER  =’ NUM8                                
     DISPLAY ‘NUM9 AFTER  =’ NUM9                                     DISPLAY ‘————————–‘                                                                                         

     DISPLAY ‘DIVIDE NUM10 BY NUM11 GIVING NUM12 REMAINDER NUM14’

     DISPLAY ‘NUM10 BEFORE =’ NUM10                              
     DISPLAY ‘NUM11 BEFORE =’ NUM11                              
     DISPLAY ‘NUM12 BEFORE =’ NUM12                              
     DISPLAY ‘NUM14 BEFORE =’ NUM14                              
     DIVIDE NUM10 BY NUM11 GIVING NUM12 REMAINDER NUM14          
     DISPLAY ‘NUM10 AFTER  =’ NUM10                              
     DISPLAY ‘NUM11 AFTER  =’ NUM11                              
     DISPLAY ‘NUM12 AFTER  =’ NUM12                              
     DISPLAY ‘NUM14 AFTER  =’ NUM14                                   DISPLAY ‘————————–‘                                                                                                                                                          

     STOP RUN.                                                  Â