title: How to read and display records one at a time in the COBOL program below?
body: <p>I am trying to write a <strong><em>COBOL</em></strong> program to read a file "INPUT.TXT" with 4 fields as given below and display the details of students. But the records are not read and displayed one by one.</p>
  
  <p>I am using <a href="http://www.compileonline.com/compile_cobol_online.php" rel="nofollow">http://www.compileonline.com/compile_cobol_online.php</a> for the program.
  The records in "INPUT.TXT" (<strong>please note that the input file is a simple text file)</strong>  are:</p>
  
  <pre><code>EMPID  NAME     COMPANY          RATING
  
  112211 UMESH    CAPGEMINI        A
  221122 ISHAN    ZALONI           A
  134231 AJMERA   GOOGLE           B
  232144 NIYANTA  WIPRO            B
  561144 KANKANA  ZETA             A
  324556 CHRISTOPHER  TCS          C
  123443 SIDDIKA       TCS         A
  </code></pre>
  
  <p>PROGRAM:</p>
  
  <pre><code> IDENTIFICATION DIVISION.
   PROGRAM-ID. SAMPLE1.                 
  
   ENVIRONMENT DIVISION.
   INPUT-OUTPUT SECTION.
   FILE-CONTROL.
   SELECT EMPFILE  ASSIGN TO 'input.txt'
   ORGANIZATION IS SEQUENTIAL       
   ACCESS MODE IS SEQUENTIAL
   FILE STATUS IS WS-FILE-STATUS. 
   DATA DIVISION.
   FILE SECTION.                        
   FD EMPFILE.                          
    01  NEWFILE.                         
        05  EMPID  PIC 9(7).          
        05  NAME   PIC A(22).                              
        05  COMPANY PIC X(10). 
        05  RATING  PIC X(1).
   WORKING-STORAGE SECTION.    
    01    WS-EOF         PIC A(1)  VALUE "N".                     
    01    WS-FILE-STATUS PIC X(2).  
  
   PROCEDURE DIVISION.
  
   MAIN-PARA.
     OPEN INPUT  EMPFILE
     PERFORM READ-PARA THRU READ-PARA-EXIT UNTIL WS-EOF="Y"
     STOP RUN.                                             
   MAIN-PARA-EXIT.
   EXIT.
  
   READ-PARA.
   READ EMPFILE                                         
   AT END                                               
     MOVE "Y" TO WS-EOF                                  
   NOT AT END                                           
     DISPLAY "*****"  NEWFILE
   END-READ.
   READ-PARA-EXIT.
   EXIT.
  </code></pre>