       IDENTIFICATION DIVISION.
       PROGRAM-ID. ARQUIVO3.
       ENVIRONMENT DIVISION.
       INPUT-OUTPUT SECTION.
       FILE-CONTROL.
       SELECT ARQ-ENT
           ASSIGN TO "Nomes.dat"
           ORGANIZATION IS LINE SEQUENTIAL
           ACCESS IS SEQUENTIAL
           FILE STATUS IS WS-FILESTATUS.
       SELECT ARQ-OUT
           ASSIGN TO "Saida.dat"
           ORGANIZATION IS LINE SEQUENTIAL
           ACCESS IS SEQUENTIAL
           FILE STATUS IS WS-FILESTATUS2.
       DATA DIVISION.
       FILE SECTION.
       FD ARQ-ENT.
       01 REG-DATA.
           05 ALU-NUM PIC 9(3).
           05 ALU-NOME PIC A(25).
       FD ARQ-OUT.
       01 REG-OUT.
           05 SAIDA-NOME PIC A(25).
       WORKING-STORAGE SECTION.
           77 WS-FILESTATUS PIC 99.
           77 WS-FILESTATUS2 PIC 99.
           77 WS-FLAG PIC 9 VALUE 0.
           01 WS-ALU.
               05 WS-ALUNUM PIC 9(03).
               05 WS-ALUNOME PIC A(25).
           01 WS-EOF PIC A(1).
       PROCEDURE DIVISION.
       A01-PROCESSA.
       OPEN INPUT ARQ-ENT.
       IF WS-FILESTATUS <> 0
           DISPLAY "ERRO DE ABERTURA. FILE STATUS: " WS-FILESTATUS
           CLOSE ARQ-ENT
           STOP RUN.
       OPEN OUTPUT ARQ-OUT.
       IF WS-FILESTATUS2 <> 0
           DISPLAY "ERRO DE ABERTURA. FILE STATUS: " WS-FILESTATUS2
           CLOSE ARQ-OUT
           STOP RUN.
       PERFORM UNTIL WS-EOF = "Y"
           READ ARQ-ENT INTO WS-ALU
               AT END MOVE "Y" TO WS-EOF
               NOT END PERFORM A02-IMPRIME
           END-READ
       END-PERFORM.
       CLOSE ARQ-ENT ARQ-OUT.
       STOP RUN.
       A02-IMPRIME.
       DISPLAY WS-ALU.
       MOVE ALU-NOME TO SAIDA-NOME.
       WRITE REG-OUT.
