When you call the Loader with the Loader CLI, you can transfer the commands and SQL statements, which are to be evaluated, to the Loader. They are transferred in a special file, the command file.
If you want to call the Loader in command file mode, you have to specify the name of the command file by means of option –b <command_file>.
loadercli -d demodb -u mona,red -n genua -b command.dat
The commands and SQL statements are in the command.dat file.
The commands and SQL statements that you specify in the command file are individually processed by the Loader in the specified order.
Note the following syntax rules for command files:
· General syntax rules
The same syntax rules apply as for calling the Loader.
· Delimiting Lines Between Commands
Individual commands in a command file are separated by a line, at the beginning of which there is a double forward slash //.
When calling the Loader CLI, you can use the option –cs to define an alternative command separator.
· Comments
You can enter comments after a double forward slash // at the start of the line. The comments are ignored by the Loader when the command file is processed.
A command file can also be generated by generating the design data in transport mode. This command file <package_name>.prt is stored in the package directory <loader_user_data>\packages in the subdirectories for the export and the import.
The command file command.dat could have the following content:
//IMPORT TABLE DATA
IMPORT TABLE hotel.customer
CATALOG INSTREAM FILE 'customer.catalog' DDL
DATA INSTREAM FILE 'customer.data' COMPRESSED ASCII
SEPARATOR ','
DELIMITER '"'
NULL
'? '
DECIMAL '//./'
BOOLEAN 'TRUE/FALSE'
TIMESTAMP ISO
DATE ISO
TIME ISO
cno 1
CHAR
title 2 CHAR DEFAULT
NULL
firstname 3 CHAR DEFAULT NULL
name 4 CHAR
zip 5 CHAR
DEFAULT NULL
address 6 CHAR
PAGE WITH 25 ROWS USAGE
//CREATE INDEX
CREATE INDEX customer_index ON hotel.customer(name ASC,firstname ASC)
//
EXPORT COLUMNS cno, title, name, firstname FROM hotel.customer WITH LOCK
MAP COLUMNS
cno 1
title 2
name 3
firstname 4
DATA
OUTSTREAM FILE 'newcustomer.data'
To execute the EXPORT/IMPORT commands and the SQL statement CREATE INDEX in command file mode enter the following Loader call:
loadercli -d demodb -u mona,red -n genua -b command.dat
The files are imported into the CUSTOMER table, an index is created and the column values CNO, TITLE, NAME and FIRSTNAME are exported.