Entering content frame

Background documentation Data Format Locate the document in its SAP Library structure

With most Loader commands for loading and unloading data, you can specify the external data type and the data format that the relevant field values in the data stream have or should have.

You can also define which separators and delimiters are to be used.

Procedure

You can specify the data format in load and unload commands for the data stream (in the syntax element stream_format_spec).

The specified data format applies to the columns that have the corresponding internal database data type.

See also:

SET Command

Syntax

<stream_format_spec> ::=
  
<bool_spec> <stream_format_spec>
<code_spec> <stream_format_spec>
| <date_spec> <stream_format_spec>
| <delimiter> <stream_format_spec>
| <int_spec> <stream_format_spec>
| <null_spec> <stream_format_spec>
| <number_spec> <stream_format_spec>
| <separator_spec> <stream_format_spec>
| <time_spec> <stream_format_spec>
| <timestamp_spec> <stream_format_spec>
| COMPRESSED <stream_format_spec>
| FORMATTED <stream_format_spec>
| FORMATTED BINARY <stream_format_spec>
| PAGES <stream_format_spec>
| RECORDS <stream_format_spec>

<bool_spec> ::= BOOLEAN '<valVALUE_FOR_TRUE>/<valVALUE_FOR_FALSE>'
<delimiter_spec> ::= DELIMITER '<valDELIMITER>'
<int_spec> ::= INTEGER HILO | INTEGER LOHI
<null_spec> ::= NULL '<valLITERAL>'
<number_spec> ::= DECIMAL '/[<t>]/<d>/'
<separator_spec> ::= SEPARATOR '<valSEPARATOR>'

valVALUE_FOR_TRUE/
valVALUE_FOR_FALSE

Defines the character string for values that are true/
Defines the character string for values that are false

valDELIMITER

DELIMITER display
No character, or exactly one character long
A blank DELIMITER is represented by entering blank single quotation marks (
'')

INTEGER HILO

The current data stream stores integers so that the byte with the lowest valency is stored first, that is, is furthest right in the binary number (the big endian).

INTEGER LOHI

The current data stream stores integers so that the byte with the highest valency is stored first, that is, the furthest right in the binary number (little endian, byte swap).

valLITERAL

Null value representation; maximum length of 20 characters

The Loader default value is:
?                   
(a question mark and 19 blank characters).

t

Defines the character for structuring thousands
The Loader default value is not a character.

d

Defines the character used to separate integers from decimal places
The Loader default value is a period.

valSEPARATOR

Separator for data fields; must be one character long

COMPRESSED

COMPRESSED (CSV, Comma Separated Values) is a format for CHAR data in which a data line must at least be long enough to represent the data. The assignment of a data field of the data stream to a column in the table is determined by the position specification.

FORMATTED

FORMATTED (FWV, Fixed Width, Columnar Values) is a format for plain text values in which a data line in the data stream corresponds to a data record. The assignment between data fields in the data stream and table columns is determined by the position specification.

FORMATTED BINARY

FORMATTED BINARY (FWV, Fixed Width, Columnar Values) is a format for binary values in which the data fields all have the same fixed length. The assignment between data fields in the data stream and table columns is determined by the position specification. Unlike the FORMATTED format, a data record does not end with an additional line break.

PAGES

The application data is stored in pages.

RECORDS

This is a proprietary MaxDB format.

Explanation

You can use the syntax rule stream_format_spec within a command for loading and unloading data to, among other things, determine the following data formats:

<bool_spec>

You use the syntax rule bool_spec to specify the character string that represents the BOOLEAN values in data streams to be unloaded from a database instance or to be loaded into a database instance.

The default value in the Loader is TRUE/FALSE. The character strings can contain a maximum of 10 characters.

<delimiter_spec>

You use the syntax rule delimiter_spec to specify which character is to be used to select application data in data streams with the COMPRESSED format.

If you want to load unselected data, enter a blank DELIMITER in the command.

<int_spec>

You use the syntax rule int_spec to define the representation of integers in data streams.

You can only do this for data streams with the FORMATTED BINARY format (binary values). This rule is ignored when you load or unload data in data streams that have the COMPRESSED format.

If the representation specified for a data stream does not match the current server, the values are adjusted before being loaded into the database or written to the data stream.

<null_spec>

You use the syntax rule null_spec to specify the character string used to represent null values that were loaded from the database instance in data streams.

<number_spec>

You use the syntax rule number_spec to specify which characters are to be used in decimal numbers to group thousands and separate integers from decimal places.

If no digit or character is specified for t or d, the Loader uses the default.

Example

DATAEXTRACT price FROM room
OUTSTREAM FILE 'room_price.data'
DECIMAL '/./,/'

Results in the following number format for a value in the file room.data:
1.150,00

<separator_spec>

You use the syntax rule separator_spec to specify which character is used to separate data fields in data streams that have the COMPRESSED format.

COMPRESSED, FORMATTED, FORMATTED BINARY, PAGES, RECORDS

These are formats of the data stream. For more explanations and examples for the formats COMPRESSED, FORMATTED, and FORMATTED BINARY, see COMPRESSED, FORMATTED, FORMATTED BINARY.

 

Leaving content frame