The syntax elements used for Loader output columns are described below.
Syntax
<export_column_spec> ::= <map_column_field> | <field_assignment> <map_column_field> ::= <column_spec> <field_spec> <field_function> <null_assign> <field_assignment> ::= '<literal>' <field_spec> <column_spec> ::= <column_name> | <column_id> <field_function> ::= <field_type> [HEX] | <numerical_functions> | <field_type> [HEX] <numerical_functions> <numerical_functions> ::= <scale_spec> | <round_or_trunc_spec> | <scale_spec> <round_or_trunc_spec> <scale_spec> ::= SCALE <unsigend_integer> <round_or_trunc_spec> ::= ROUND <unsigend_integer> | TRUNC <unsigend_integer>
The syntax element export_column_spec is used in the EXPORT COLUMNS command. Syntax elements such as column_name and field_spec (position description) are also used in the column description of other Loader commands.
In export commands, the syntax element map_column_field. is used 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. Syntax rule column_spec specifies the column name or column ID.
Example
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 'customer_fwv.data' FWV
The column name column_name denotes the column in the SELECT expression.
Example
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 'customer_fwv.data' FWV
The column ID column_id denotes the position of the column in the SELECT expression.
In a command for exporting or importing application data, you use the field_function syntax rule to specify the data fields in the data stream (external data type, position, and so on). You can use the syntax rule numerical_functions to scale (<scale_spec> ::= SCALE <unsigned_integer>: Scaling factor unsigned_integer can be positive or negative; value to which the syntax rule refers is multiplied by the corresponding power of ten), round and/or truncate numeric data values (<round_or_trunc_spec> ::= ROUND/TRUNC <unsigned_integer> : unsigned_integer defines the number of decimal places; value must be between 0 and 18; function does not have any effect if the number does not have any decimal places) when you import data from the data stream to the target table or export data from the source table to the data stream.
Note
You always have to specify scale_spec before round_or_trunc_spec.
You use the syntax rule round_or_trunc_spec to specify the number of decimal places for a number.
ROUND <unsigned_integer>: The value is rounded off at the (<unsigend_integer>+1)th decimal place. If this number is >= 5, the value is rounded up. If it is < 5, the value is rounded down. The result is a number in which the (<unsigend_integer>+1)th and all subsequent decimal places are equal to 0. However, the first digits in the number may have been changed by rounding.
TRUNC <unsigned_integer>: The (<unsigend_integer>+1)th and all subsequent decimal places of the value are set to 0. The first unsigned_integer decimal places remain unchanged.
Example
EXPORT COLUMNS * FROM hotel.room
MAP COLUMNS
hno 1
type 2
free 3
price 4 SCALE —1 TRUNC 2
DATA OUTSTREAM 'room_csv.data'
You can use the syntax element field_assignment to define literals for output in addition to the output values in the export command. The literal is specified in single quotation marks in place of the column name or column ID.
Example
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 'customer_fwv.data' FWV