How to write a dbload command file in delimiter form

Command files must contain required elements, including delimiters.

The FILE statement in the following example describes the stock.unl data rows as composed of six fields, each separated by a vertical bar (|) as the delimiter.

FILE stock.unl DELIMITER '|' 6;
INSERT INTO stock;

Two consecutive delimiters define a null field. As a precaution, you can place a delimiter immediately before the new-line character that marks the end of each data row. If the last field of a data row has data, you must use a delimiter. If you omit this delimiter, an error results.

Compare the FILE statement with the data rows in the following example, which appear in the input file stock.unl. (Because the last field is not followed by a delimiter, an error results if any data row ends with an empty field.)
1|SMT|baseball gloves|450.00|case|10 gloves/case
2|HRO|baseball|126.00|case|24/case
3|SHK|baseball bat|240.00|case|12/case

The example INSERT statement contains only the required elements. Because the column list is omitted, the INSERT statement implies that values are to be inserted into every field in the stock table. Because the VALUES clause is omitted, the INSERT statement implies that the input values for every field are defined in the most recent FILE statement. This INSERT statement is valid because the stock table contains six fields, which correspond to the number of values that the FILE statement defines.

The following example shows the first data row that is inserted into stock from this INSERT statement.
Field Column Value
f01 stock_num 1
f02 manu_code SMT
f03 description baseball gloves
f04 unit_price 450.00
f05 unit case
f06 unit_descr 10 gloves/case
The FILE and INSERT statement in the following example illustrates a more complex INSERT statement syntax:
FILE stock.unl DELIMITER '|' 6;
INSERT INTO new_stock (col1, col2, col3, col5, col6)
   VALUES (f01, f03, f02, f05, 'autographed');
In this example, the VALUES clause uses the field names that dbload assigns automatically. You must reference the automatically assigned field names with the letter f followed by a number: f01, f02, f10, f100, f999, f1000, and so on. All other formats are incorrect.
Tip: The first nine fields must include a zero: f01, f02, ..., f09.

The user changed the column names, the order of the data, and the meaning of col6 in the new stock table. Because the fourth column in new_stock (col4) is not named in the column list, the new data row contains a null value in the col4 position (assuming that the column permits null values). If no default is specified for col4, the inserted value is null.

The following table shows the first data row that is inserted into new_stock from this INSERT statement.

Column Value
col1 1
col2 baseball gloves
col3 SMT
col4 null
col5 case
col6 autographed