I’m impressed with how simple it is to read and write CSV files. Natural handles all the messy details, such as headers, delimiters, and quoted strings. All I need to do is provide a list of field names. For example, to read a CSV with values delimited with semi-colons and containing no header line (Natural’s defaults):
DEFINE DATA LOCAL
1 #CSV
2 #FIELD1 (A5)
2 #FIELD2 (N2)
2 #FIELD3 (A8)
END-DEFINE
DEFINE WORK FILE 1 'c:\spreadsheet.csv' TYPE "CSV"
READ WORK 1 #CSV
DISPLAY #CSV
END-WORK
END
But the only way I can see to change the delimiter and header specifications is via the Configuration Utility. In my client’s environment, changing Natparm files requires a mountain of paperwork, so I was hoping to find WORK subparameters that would allow me to specify these parms dynamically in a batch script. Even a User Exit would be acceptable.
Is there another way to do this?