       IDENTIFICATION DIVISION.
       PROGRAM-ID. PGM001.
       ENVIRONMENT DIVISION.
       INPUT-OUTPUT SECTION.
       FILE-CONTROL.
       SELECT ARQ-ENTRADA ASSIGN TO "SortAlu.dat" FILE STATUS IS WS-FS.
       DATA DIVISION.
       FILE SECTION.
       FD ARQ-ENTRADA.
       01 REG-DATA.
           05 ALU-NUM PIC X(03).
           05 ALU-NOME PIC A(25).
       WORKING-STORAGE SECTION.
       77 WS-FS PIC 99.
       01 WS-ALU.
           05 WS-ALUNUM PIC X(03).
           05 WS-ALUNOME PIC A(25).
       01 WS-EOF PIC A(1).
       PROCEDURE DIVISION.
       OPEN INPUT ARQ-ENTRADA.
       IF WS-FS <> 0
           DISPLAY "ERRO NA ABERTURA WS-FS: " WS-FS
           CLOSE ARQ-ENTRADA
           STOP RUN.
       A03-CONSULTA.
       PERFORM UNTIL WS-EOF = "Y"
           READ ARQ-ENTRADA INTO WS-ALU
               AT END MOVE "Y" TO WS-EOF
               NOT END PERFORM A03-LE
           END-READ
       END-PERFORM.
       READ ARQ-ENTRADA RECORD INTO WS-ALU.
       CLOSE ARQ-ENTRADA.
       STOP RUN.
       A03-LE.
       DISPLAY "ID ALUNO: " ALU-NUM.
       DISPLAY "NOME ALU: " ALU-NOME.
