Skip to Content
Custom Search

COBOL PERFORM VARYING UNTIL

 

PERFORM VARYING UNTIL
 
The following COBOL program depicts the use of 
PERFORM VARYING UNTIL
 
       IDENTIFICATION DIVISION.
       PROGRAM-ID. PGM019.
       AUTHOR. MAINFRAMEWIZARD.
       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01 WS-SUB   PIC 9  VALUE ZEROS.
       PROCEDURE DIVISION.
       10000-MAIN-PARA.
             MOVE 5 TO WS-SUB.
             PERFORM 20000-FIRST-PARA VARYING WS-SUB FROM 1 BY 1 UNTIL
             WS-SUB=5
             DISPLAY 'PARA NAME IS  10000-FIRST-PARA'
             STOP RUN.
       20000-FIRST-PARA.
             DISPLAY 'VALUE OF WS-SUB IS = ' WS-SUB.
 
 
 
The ouput of the above program will be
 
VALUE OF WS-SUB IS = 1                                                                                                   
VALUE OF WS-SUB IS = 2                                                                                                   
VALUE OF WS-SUB IS = 3                                                                                                   
VALUE OF WS-SUB IS = 4                                                                                                   
PARA NAME IS  10000-FIRST-PARA                                                                                           

Click the +1 button  below to share it with your friends and colleagues

 

Share this if you liked it!

 

Disclaimer



Who's online

There are currently 0 users and 21 guests online.
Dr. Radut | page