Background documentation COMPRESSED Locate the document in its SAP Library structure

COMPRESSED (CSV, Comma Separated Values) is a possible format of a data stream.

If a command to load to unload 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 (SAP DB Loader default value). This means that it does not have to be specified explicitly in a load or unload 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 a load or unload command, however the data is not in plain text, the SAP DB Loader creates an error message.

Example

customer.data

Position number

1   2       3    4       ....

 

001,miller,10277,New York
002,
smith,60678,Chicago
003,kleinert,
33184,Miami

The data fields do not have a uniform format but are separated by commas:

FASTLOAD command:

FASTLOAD TABLE customer
  cno       1
  name 2
  zip       3
  location  4
INFILE 'customer.data'

Data Line

In COMPRESSED format, a data line must at least be long enough 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 loaded, a data line in a source data stream of this format corresponds to exactly one data record in the target table.

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.

Data Fields

Data fields in the data streams must have the external data type CHAR.

The individual data fields are separated by a freely selectable character (SAP DB Loader default value: comma). They can also be encapsulated in freely selectable characters (SAP DB Loader default value: 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.

Position Specification

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 loading or unloading 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 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.

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.