COMPRESSED (CSV, Comma Separated Values) is a possible format of a data stream.
If a command for unloading or loading data does not explicitly specify the format FORMATTED or FORMATTED BINARY, the system assumes that the data in the source data stream is in the COMPRESSED format (Loader default value). This means that it does not have to be specified explicitly in an unload or load command.
The COMPRESSED format can only be used for source data streams with plain text values. Data streams with binary values must be loaded with the FORMATTED BINARY format.
If you do not specify a format in an unload or load command, however, the data is not in plain text, the Loader creates an error message.
customer.data
Position number |
1 2 3 4 .... |
|
001,miller,10277,New
York |
The data fields do not have a uniform format but are separated by commas:
FASTLOAD command:
FASTLOAD TABLE
customer
cno 1
surname 2
zip 3
place 4
INFILE 'customer.data’
In COMPRESSED format, a data line is compressed to the minimum required to represent the data. The length of the individual data fields and the total length of the data lines can vary. Each data line ends with a line break.
When data is unloaded, a data line in a source table of this format corresponds to exactly one data record in the target data stream.
When data is loaded, a data line in a source data stream of this format corresponds to exactly one data record in the target table.
Data fields in the data streams must have the external data type CHAR.
The individual data fields are separated by a freely selectable character (default value of the Loader: comma). They can also be encapsulated in freely selectable characters (default value of the Loader: double quotation marks).
If delimiters follow each other directly in a data line, then the value is the empty character string. If the relative position is larger than the number of values in the line, the value is also the empty character string.
The assignment of a data field of the data stream to a column in the table is determined by the position specification <field_pos> in a command for unloading or loading data. This specifies a relative position within the data record. It therefore specifies which value in a data record is to be loaded into or unloaded from a specific column.
When you unload data from the database to a target data stream, assign the position 1 to the first column in your list. The position numbers of the following columns rise by 1 each time. This also means that each position number can only be assigned once.
When you load data from a source table, the data fields in the target table in the database must be sorted in ascending order. You can also assign the same input values to different columns or even omit positions. If consecutive delimiters are detected or if the relative position is greater than the number of values in the line, the value is the empty character string.