800-READCSV

Name

800-READCSV-<FileName>

Description

On the first call, this API opens the file for input, if it is not already open. If there is a header, the routine reads the header and determines that fields are to be read and in what order. On subsequent calls, it reads a record into working storage (REC area), initializing any fields not flagged as used.

Return Values

One record is read from the CSV work file.

Programming Example: Reading Data from a CSV File

PROCEDURE DIVISION

       100-PROGRAM-CONTROL.
            .
            . 
           PERFORM 800-OPENINPUTCSV-CSVOUT1.    


           PERFORM 1000-READ-CSV-LOOP
           THRU    1000-LOOP-END
           UNTIL   .....

           PERFORM 800-CLOSECSV-CSVOUT1
           STOP RUN.

       100-END.
             .
             .
       1000-READ-CSV-LOOP.

           PERFORM 800-READCSV-CSVOUT1.

           MOVE CVO-COMPANY            TO API-COMPANY.
           MOVE CVO-PROC-LEVEL         TO API-PROC-LEVEL.
           MOVE CVO-INVOICE-AMT        TO API-INVOICE-AMT.
           MOVE CVO-INVOICE-DATE       TO API-INVOICE-DATE.
             .
             .
           1000-READ-LOOP-END.