COBOL Program to read a flat file sequentially and write it to an output file, not able to read at all loop is going infinite
===

i'm trying to write COBOL Program to read a flat file sequentially and write it to an output file, i'm able to read only one record at a time, not able to read next record what should i do?

here is my code,




PROCEDURE DIVISION.                                           
    OPEN INPUT FILEX.                                         
    PERFORM READ-PARA THRU END-PARA UNTIL END-OF-FILE = 'Y'.  
    CLOSE FILEX.                                              
    STOP RUN.                                                 
READ-PARA.                                                    
    READ FILEX                                                
      AT END                                                  
    MOVE 'Y' TO END-OF-FILE                                   
    DISPLAY OFFCODE1                                          
    DISPLAY AGCODE1                                           
    DISPLAY POLNO1                                            
    DISPLAY EFFDATE1                                          
    DISPLAY EXPDATE                                           
    DISPLAY REPCODE                                           
    DISPLAY POLHOLDER1                                        
    DISPLAY LOCATION1                                         
    GO TO END-PARA.                                           
END-PARA.   
