S@CSVREAD@

Name

S@CSVREAD@<Prefix>

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

C                   CALLP     S@CSVOPINP@CSV   
C                   CALLP     S@CSVREAD@CSV                             
C                   IF        PCSVNF#FOUND = *ZEROS                     
C                             AND DCKP@NOTFOUND <> FALSE                
C                   EVAL      E@ERRORNBR     = 101                      
C                   CALLP     U@PRINTERRMSG                             
C                   RETURN                                              
C                   ENDIF                                               
              .
              .
              .
C                   IF        F1@INTOPT = 'T'                           
C                   CALLP     S@CSVCLOSE@CSV                            
C                   IF        F1@UPDOPT = 'Y'                           
C                   CALLP     S@CSVOPOUT@CSV                            
C                   CALLP     S@CSVCLOSE@CSV