Using CSV Routines
The routines described in this chapter give you access to standard methods for reading or writing Comma-Separated Value (CSV) data. This chapter also describes limitations on using the CSV routines, and gives examples of how to use them.
After you define a work file as a comma-separated variable (CSV) file using Work File Definition, you can use the following routines to open, close, read from and write to CSV files, or to change the name or type of the CSV work file.
The syntax for these routines is generated when a program is compiled. You do not need to specify any parameters for these APIs; you only need to make the API call with the correct file name. All other configuration is completed using the Workfile Definition (workdef) form as described in the Application Development Workbench guide.
Limitations on Using CSV Work Files
The application program does not know that this file exists, therefore the following limitations apply to CSV files manipulated by application programs.
-
You can read from an existing file, append to an existing file, or write to a new file.
-
You must read, write or append to a CSV work file outside of a transaction state.
-
The first read or write you perform on a previously unopened CSV work file must also be outside of a transaction state.