Character-position form of the FILE and INSERT statements
The FILE and INSERT statements that define information for the dbload utility can appear in a character-position form.
The examples in this topic are based on an input data file, cust_loc_data,
which contains the last four columns (city, state, zipcode,
and phone) of the customer table. Fields in the input
file are padded with blanks to create data rows in which the location
of data fields and the number of characters are the same across all
rows. The definitions for these fields are CHAR(15), CHAR(2), CHAR(5),
and CHAR(12), respectively. A Sample Data
File displays
the character positions and five example data rows from the cust_loc_data file.
The following example of a dbload command file illustrates
the character-position form of the FILE and INSERT statements. The
example includes two new tables, cust_address and cust_sort,
to receive the data. For the purpose of this example, cust_address contains
four columns, the second of which is omitted from the column list.
The cust_sort table contains two columns.
FILE cust_loc_data
(city 1-15,
state 16-17,
area_cd 23-25 NULL = 'xxx',
phone 23-34 NULL = 'xxx-xxx-xxxx',
zip 18-22,
state_area 16-17 : 23-25);
INSERT INTO cust_address (col1, col3, col4)
VALUES (city, state, zip);
INSERT INTO cust_sort
VALUES (area_cd, zip);