HP c-tree-SQL ISQL and Tools manual Commands File, Variable Length Records, Fixed Length Records

Models: c-tree-SQL ISQL and Tools

1 99
Download 99 pages 4.83 Kb
Page 74
Image 74

ISQL and Tools

4.4.1Variable Length Records

For variable length records, the fields in the data file can be of varying length. Unless the key- word FIXED is used in the commands file, it is assumed that the dbload record processing will be for variable length records.

4.4.2Fixed Length Records

For fixed length records, the fields in the data file must be of fixed length. The length of the record must be the same for all records and is specified in the commands file. In case of fixed length records, the field and record delimiters are ignored. That is, the POSITION specification must be such that the delimiters are ignored. For more information on the commands file refer to Section 4.5 "The Commands File" on page 4-4.

The data files that contain fixed length records can either be ASCII or binary files.

4.5THE COMMANDS FILE

The commands file specifies instructions for dbload to load the records into the table specified. Thus the commands file defines what dbload will be performing for a particular loading pro- cess.

There is no file naming convention for the commands file. For example, the commands file name to load the orders table could be orders.cmd.

The commands file must contain the following parts:

The DEFINE RECORD statement

The FOR EACH statement

The syntax definition for the commands file is as shown:

dbload_commands: define_record_statement for_each_statement

The following is sample commands file showing load instructions.

DEFINE RECORD ord_rec AS

( ord_no, item_name, date, item_qty ) FIELD DELIMITER ' ' ;

FOR EACH RECORD ord_rec FROM ord_in

INSERT INTO ADMIN.orders (order_no, product, order_date, qty)

VALUES (ord_no, item_name, date, item_qty) ;

NEXT RECORD

The above commands specification instructs dbload to load records into the orders table. The fields in the data file, ord_in, appear in the order listed in the DEFINE RECORD statement.

4-4

FairCom Corporation

Page 74
Image 74
HP c-tree-SQL ISQL and Tools manual Commands File, Variable Length Records, Fixed Length Records, Next Record