Note the following syntax rules for command files.
Syntax Rules for Calling the Loader
Individual commands in a command file are separated by a line, at the beginning of which there is a double forward slash //.
LOADERCLI, you can use the option –cs to define an alternative command separator.
After a double forward slash // at the start of the line, you can enter comments. The comments are ignored by the Loader during the processing of the command file.
CREATE TABLE customer
(cno FIXED(4,0) NOT NULL,
title CHAR(7),
firstname CHAR(10),
name CHAR(10) NOT NULL,
zip CHAR(5),
address CHAR(25) NOT NULL,
PRIMARY KEY (cno),
CONSTRAINT cno_dom CHECK cno BETWEEN 1 AND 9999,
CONSTRAINT title CHECK title IN ('Mr','Mrs','Company'),
CONSTRAINT zip_dom CHECK
SUBSTR(ZIP,1,1) BETWEEN '1' AND '9' AND
SUBSTR(ZIP,2,1) BETWEEN '0' AND '9' AND
SUBSTR(ZIP,3,1) BETWEEN '0' AND '9' AND
SUBSTR(ZIP,4,1) BETWEEN '0' AND '9' AND
SUBSTR(ZIP,5,1) BETWEEN '0' AND '9',
FOREIGN KEY city_customer (zip) REFERENCES city (zip) ON DELETE RESTRICT
//
DATALOAD TABLE customer
cno 1
CHAR
title 2 CHAR
DEFAULT NULL
firstname 3 CHAR DEFAULT NULL
name 4
CHAR
zip 5
CHAR DEFAULT NULL
address 6 CHAR
INSTREAM 'customer.data'
//create index
CREATE INDEX customer_index ON customer (name)
//
DATAEXTRACT cno, name, zip, address from customer
OUTFIELDS
cno 1
name 2
zip 3
address 4
OUTSTREAM 'newcustomer.data'