       ID  DIVISION.
       PROGRAM-ID. CBRDWR1.
       AUTHOR. UNIKIX.
       ENVIRONMENT DIVISION.
       CONFIGURATION SECTION.
       INPUT-OUTPUT SECTION.
       FILE-CONTROL.
           SELECT  INPREC1  ASSIGN TO EBMINP1
                            ORGANIZATION IS SEQUENTIAL
                            ACCESS IS SEQUENTIAL
                            FILE STATUS IS INPREC1-STATUS.
           SELECT  OUTREC1  ASSIGN TO EBMOUT1
                            ORGANIZATION IS SEQUENTIAL
                            ACCESS IS SEQUENTIAL
                            FILE STATUS IS OUTREC1-STATUS.
       DATA DIVISION.
       FILE SECTION.
       FD  INPREC1.
       01  INP-ACCTREC.
           02  INP-DOACCT               PIC 9(9) COMP.
           02  INP-DOSNAME              PIC X(18).
           02  INP-DOFNAME              PIC X(12).
           02  INP-DOMI                 PIC X.
           02  INP-DOTTL                PIC X(4).
           02  INP-DOTEL                PIC X(10).
       FD  OUTREC1.
       01  OUT-ACCTREC.
           02  OUT-DOACCT               PIC 9(9) COMP.
           02  OUT-DOSNAME              PIC X(18).
           02  OUT-DOFNAME              PIC X(12).
           02  OUT-DOMI                 PIC X.
           02  OUT-DOTTL                PIC X(4).
           02  OUT-DOTEL                PIC X(10).
       WORKING-STORAGE SECTION.
       01  INPREC1-STATUS         PIC  9(2) VALUE ZEROES.
       01  OUTREC1-STATUS         PIC  9(2) VALUE ZEROES.
       01  CONDCODE               PIC S9(4) COMP.
       01  COUNTREC               PIC 9(9) COMP.
       01  MOD-COUNTREC           PIC 9(9) COMP.
       01  DISPLAY-RECS           PIC 9(1) VALUE 1.
       PROCEDURE DIVISION.
         OPEN INPUT INPREC1.
         IF INPREC1-STATUS NOT = 00 GO TO ABTPRIMSEQINP1.
         OPEN OUTPUT OUTREC1.
         IF OUTREC1-STATUS NOT = 00 GO TO ABTPRIMSEQOUT1.
         MOVE 0 TO COUNTREC.
         DISPLAY '================================================='.
       LOOP-REC.
           READ INPREC1 AT END GO TO ENDLOOP1.
           IF INPREC1-STATUS > 02 GO TO PRIMSEQIOERW1.
           ADD 1 TO COUNTREC.
           MOVE FUNCTION MOD (INP-DOACCT 10000) TO MOD-COUNTREC.
           IF MOD-COUNTREC = ZERO
           THEN
             DISPLAY '  ' INP-DOACCT ' RECORDS READ'
           END-IF.
           MOVE INP-ACCTREC TO OUT-ACCTREC.
           WRITE OUT-ACCTREC.
           IF OUTREC1-STATUS > 02 GO TO PRIMSEQIOERW1.
           IF DISPLAY-RECS > 0
             DISPLAY 'RECORD  '  INP-DOACCT.
           GO TO LOOP-REC.
       ENDLOOP1.
         DISPLAY '================================================='.
         DISPLAY ' NUMBER OF RECORDS PROCESSED = ' COUNTREC.
         CLOSE INPREC1.
         CLOSE OUTREC1.
	        STOP RUN.
       PRIMSEQIOERR1.
         DISPLAY ' ERROR READING INPUT1 FILE. STATUS = ' INPREC1-STATUS.
         MOVE INPREC1-STATUS TO CONDCODE.
         CLOSE INPREC1.
         CLOSE OUTREC1.
         CALL "CCF_SET_CONDCODE" USING CONDCODE.
         STOP RUN.
       PRIMSEQIOERW1.
         DISPLAY ' ERROR WRITING OUTPUT1 FILE. STATUS = ' OUTREC1-STATUS 
         MOVE OUTREC1-STATUS TO CONDCODE.
         CLOSE INPREC1.
         CLOSE OUTREC1.
         CALL "CCF_SET_CONDCODE" USING CONDCODE.
         STOP RUN.
       ABTPRIMSEQINP1.
         DISPLAY ' ERROR OPENING INPUT1 FILE. STATUS = ' INPREC1-STATUS.
         MOVE INPREC1-STATUS TO CONDCODE.
         CALL "CCF_SET_CONDCODE" USING CONDCODE.
         STOP RUN.
       ABTPRIMSEQOUT1.
         DISPLAY ' ERROR OPENING OUTPUT1 FILE. STATUS = ' OUTREC1-STATUS 
         MOVE OUTREC1-STATUS TO CONDCODE.
         CALL "CCF_SET_CONDCODE" USING CONDCODE.
         STOP RUN.
