## Command File Mode

Below are instructions on executing the transport, export or import of data when the Loader CLI is in command mode.

### Prerequisites

You require the Demo Databases DEMODB and TESTDB.

Start the Loader in the command file mode: loadercli –b <command.dat>

The command_file contains the Loader commands necessary for the planned transformation.

A command file can be generated, for example, when a transformation with the Loader in transport mode is executed. You can then modify the file and execute it in the command file mode of the Loader.

See also:

Loader, Command File Mode, Command File, Transport Mode, Transformation

### Examples

#### Calling the Loader CLI in Command File Mode

loadercli -b command.dat -d demodb -u mona,red –n genua –E 20

The Loader establishes a connection to the database instance DEMODB on computer GENUA for the user MONA. The Loader processes the commands and statements contained in the command file command.dat. If errors occur (return code <> 0), the processing of the command file is terminated as soon as 20 commands have been terminated with an error.

The command file command.dat could have the following content:

//IMPORT TABLE DATA
IMPORT TABLE hotel.customer
CATALOG INSTREAM 'customer_ddl.catalog'
DATA INSTREAM 'customer_csv.data'
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
DATA OUTSTREAM 'newcustomer_csv.data'

In this command file, you can find the following Loader commands and SQL statements: IMPORT TABLE, CREATE INDEX and EXPORT COLUMNS. You have to specify the information on the database session (database user, name of database instance, name of database computer) as a command line option when you call the Loader.

#### Calling the Loader CLI in Command File Mode with an Explicitly Specified Command Separator

loadercli -b command.dat -d demodb -u mona,red –n genua –E 20 –cs ;

The Loader establishes a connection to the database instance DEMODB on computer GENUA for the user MONA. The Loader processes the commands and statements contained in the command file command.dat. If errors occur (return code <> 0), the processing of the command file is terminated as soon as 20 commands have been terminated with an error.

The command file command.dat could have the following content:

//IMPORT TABLE DATA
IMPORT TABLE hotel.customer
CATALOG INSTREAM 'customer_ddl.catalog'
DATA INSTREAM 'customer_csv.data'
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
DATA OUTSTREAM 'newcustomer_csv.data';

In this command file, you can find the following Loader commands and SQL statements: IMPORT TABLE, CREATE INDEX and EXPORT COLUMNS, all of which are completed with a semicolon. You have to specify the information on the database session (database user, name of database instance, name of database computer) as a command line option when you call the Loader.

#### Creating a Command File in Transport Mode and Executing it in the Command File Mode

You have already executed an export with the Loader in transport mode. The package directory contains the command file 20060322101010.EXPORT.

You can execute the commands contained in the command file in command file mode.

To do this, proceed as follows:

...

1. Go to package directory:
<loader_user_data>\packages\export\GENUA\DEMODB\20060322101010

2. Start the export:
loadercli –b 20060322101010.EXPORT –d demodb –u mona,red –s hotel –E 10

See also:

Transport Mode

Session Mode

Loader, Log File