The syntax elements used for the Loader output columns are described below.
<output_column> := <column_id_spec> | <lit_column_spec>
<column_id_spec> |
<column_id> <field_pos> <format_spec> <null_assign> |
<lit_column_spec> |
'<valLITERAL>' <field_pos> |
<valLITERAL> |
Text constant |
<column_id_spec> ::= <column_id> <field_pos> <format_spec> <null_assign>
<column_id> |
<valCOLUMN_NAME> | <valCOLUMN_ID> |
<valCOLUMN_NAME> |
Name of Column |
<valCOLUMN_ID> |
Column ID |
<field_pos> |
|
<format_spec> |
<field_format> [HEX]
[<numerical_functions>] |
<field_format> |
|
HEX |
You can define HEX values. |
<numerical_functions> |
<scale_spec> | <round_or_trunc_spec> | <scale_spec> <round_or_trunc_spec> See also: Column Description |
<null_assign> |
[IF] NULL SET '<valLITERAL>' |
<valLITERAL> |
Null value Representation |
These syntax elements are used in the EXPORT COLUMNS command.
You use the syntax element column_id_spec in export commands to assign the data fields of the data stream to the columns of the source table. You specify the external data types and the conditions for exporting the application data.
You use the syntax rule column_id to specify the column name or column number.
EXPORT COLUMNS cno, name, zip, address FROM
hotel.customer
MAP COLUMNS
cno 01-05
name 06-15
zip 16-20
address 21-45
DATA OUTSTREAM FILE 'customer.data' FORMATTED
The column number valCOLUMN_ID indicates the position of the column in the SELECT statement.
EXPORT COLUMNS cno, name, zip, address FROM
hotel.customer
MAP COLUMNS
1 01-05
2 06-15
3 16-20
4 21-45
DATA OUTSTREAM FILE 'customer.data' FORMATTED
Decide whether you want your column descriptions to contain field_pos field descriptions. However, you must specify position descriptions for all or none of the described columns. Otherwise, the Loader generates an error and terminates the command.
Enter position descriptions field_pos as relative positions only.
If you enter position descriptions with start and end positions for single columns or all columns, the Loader generates an error and terminates the command.
EXPORT COLUMNS * from hotel.reservation
MAP COLUMNS
rno 1
cno 2
hno 3
type 4
arrival 5
departure 6-15 ERROR
DATA OUTSTREAM FILE 'reservation.data' COMPRESSED
Assign position 1 to the first column in your list. The position numbers of the following columns increase by 1 each time. This also means that each position number can only be assigned once.
If you do not observe these rules, the Loader generates an error and terminates the command.
EXPORT COLUMNS * from hotel.reservation
MAP COLUMNS
rno 1
cno 2
hno 3
type 4
arrival 5 ERROR
departure 6
DATA OUTSTREAM FILE 'reservation.data' COMPRESSED
You can assign a column to multiple different positions.
EXPORT COLUMNS * from hotel.reservation
MAP COLUMNS
rno 1
cno 2
hno 3
type 4
arrival 5
departure 6
type 7
DATA OUTSTREAM FILE 'reservation.data'
COMPRESSED
Specify all position descriptions with exact start and end positions.
Specify only
ascending, non-overlapping values for position descriptions.
If the positions entered are not consecutive, the Loader fills the gaps with
blank characters. This also applies to
binary data.
EXPORT COLUMNS * from hotel.reservation
MAP COLUMNS
rno 01-05
cno 06-10
hno 11-15
type 16-21
arrival 25-34
depature 36-45
DATA OUTSTREAM FILE 'reservation.data'
FORMATTED
Define the positions for the data stream so that they are at least as long as the length of the values in the database.
If you define a position for the data stream that is longer than the length of the value in the database, the following occurs:
· Character strings are aligned left and blank characters entered to make them the correct length.
· Numeric values are aligned right and blank characters entered to make them the correct length.
If you define a position for the data stream that is shorter than the length of the value in the database, the Loader generates an error and terminates the command.
You use the syntax element null_assign in a command for exporting data to specify which value for the data field of the source table is written to the data stream if the value in the source table is a NULL value.
Place the value for the NULL value representation in single quotation marks. This is a plain text value that the Loader represents as a character string or binary numeric value. This depends on the external data type of the column for which you want to generate the null value representation.
If you want to display the null value representation in one of the external data types for binary values, it must have a valid numeric format. This means either a floating decimal number in mantissa/exponent representation or a fixed point number with the currently agreed or standard decimal setting.
The generated null value representation is written to the same place in the data stream as the actual column value.
· If the null value representation is shorter than the length of the value specified by the position, the value is filled with blank characters. If the null value representation is longer, it is shortened to the specified length, and the Loader generates a warning.
· If columns in the target table permit NULL values and you have not specified a NULL value representation, the Loader default is used for exported NULL values (SET <null_spec>). This has the external data type CHAR.
· If you define a null value representation for exporting NOT-NULL columns, it does not cause an error.
You want to
export the source table room from the database instance into
the room.data data stream. Some of the columns in the table
contain NULL values.
Define a separate condition for each of these columns. If this condition is
met, the corresponding null value representation is entered in the data
stream.
EXPORT COLUMNS * FROM hotel.room
MAP COLUMNS
hno 1
type 2
free 3 IF NULL SET '0'
price 4 IF NULL SET 'X'
DATA OUTSTREAM FILE 'room.data'
You want to
export the source table room from the database instance into
the room.data data stream. Some of the columns in the table
contain NULL values.
Because there is no null value representation defined for the column in the
command, but all values have the external data type CHAR, the Loader default
null value representation '?' is used.
EXPORT COLUMNS * FROM hotel.room
MAP COLUMNS
hno 1
type 2
free 3
price 4
DATA OUTSTREAM FILE 'room.data'
You want to
export the source table room from the database instance into
the room data stream. Some of the columns in the table
contain NULL values.
Because no null value representation is defined for the column in the command,
the Loader attempts to use the null value representation defined as a default
(data type CHAR). This causes an error if a numeric external data type has
been defined for the columns. The command terminates with an error
message.
EXPORT
COLUMNS * FROM hotel.room
MAP COLUMNS
hno 01-05
type 06-11
free 12-15 INTEGER
price 16-19 INTEGER
DATA OUTSTREAM FILE 'room.data' FORMATTED BINARY
You use the syntax element lit_column_spec to define text constants for output in addition to the output values in the export command.
The text constant is specified in single quotation marks instead of the column name or column ID (column_id).
EXPORT COLUMNS * from hotel.customer
MAP COLUMNS
'customer number:' 01-16
cno 17-21
title 22-28
firstname 29-38
name 39-48
zip 49-53
address 54-78
DATA OUTSTREAM FILE 'customer.data' FORMATTED
See also: