IBM 000-8697 Benutzerhandbuch

Seite von 702
Utilities
7-25
How to Create a Command File
The
FILE
 statement describes the stock.unl data rows as composed of six
fields, each separated by a vertical bar (| =
ASCII
 124) as the delimiter.
Compare the
FILE
 statement with the following data rows, which appear in
the input file stock.unl. (Since 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. Since the
column list is omitted, the
INSERT
 statement implies that values are to be
inserted into every field in the stock table. Since 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 is the same number of
values defined by the
FILE
statement.
The first data row inserted into stock from this
INSERT
 statement is as
follows:
The following example
FILE
 and
INSERT
 statement set 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");
Column
Value
stock_num
1
manu_code
SMT
description
baseball gloves
unit_price
450.00
unit
case
unit_descr
10 gloves/case