Each record in a CSV file contains a row of data. The information from each column within the row is set off by a delimiter such as a comma (the default). CSV files provide a simple, standard, human-readable way to store data from a spreadsheet or database.
123,yes,3/9/2007,Rahima -1,no ,9/9/1999,Jorge 92,yes,,Ludmilla
record CsvRec type CSVRecord { fileName = "empfile", delimiter = ",", textQualifier = "\"", style = CsvStyle.quoted, labels = [ "Job Code", "Permanent?", "Hire Date", "First Name" ] } jobCode int; permStatus char(3); hireDate date?; firstName string; end
The way that EGL uses the text qualifier depends on the value of the style property. EGL interprets the text qualifier character when it reads (with the get next statement), and adds the text qualifier character when it writes (with the add statement). The qualifiers are never stored as part of the CSVRecord.
Steve "Sparky"
92,yes,,"Steve ""Sparky"""
92,yes,,Steve ""Sparky""
92,yes,,Steve \"Sparky\"
92,yes,,"Steve ""Sparky"""
Steve "Sparky"
For more information about reading and writing to CSV files, see add considerations for file I/O and get considerations for file I/O.
Platform | Issue |
---|---|
Java™ generation and debug | The resource association type for the CSVRecord should be seqws. CSVRecords do not use the formFeedOnClose and text fields in the resource association. The other fields have their usual meanings. |
COBOL generation | The CSVRecord stereotype is not supported. |