IBM 000-8697 Server User Manual


 
Utilities 7-21
How to Create a Command File
How to Create a Command File
Before you use dbload, you first create an ASCII command file that names the
input data files and the tables that receive the data. The command file maps
fields from one or more input files into columns of one or more tables within
your database.
The command file contains only FILE and INSERT statements. Each FILE
statement names an input data file. The FILE statement also defines the data
fields from the input file that will be inserted into the table. Each INSERT
statement names a table that will receive the data. The INSERT statement also
defines how dbload will place the data described in the FILE statement into
the columns of the table.
Within the command file, the FILE statement can appear in the following two
forms:
Delimiter form
Character-position form
Use the delimiter form of the FILE statement when every field in the input
data row uses the same delimiter and every row ends with a NEWLINE
character. This format is typical of data rows with variable-length fields. You
can also use the delimiter form of the FILE statement with fixed-length fields
as long as the data rows meet the delimiter and NEWLINE requirements. The
delimiter form of FILE and INSERT is easier to use than the character-position
form.
Use the character-position form of the FILE statement when you cannot rely
on delimiters and you need to identify the input data fields by character
position within the input row. For example, you would use this form to
indicate that the first input data field begins at character position 1 and
continues until character position 20.
Another reason to use this second form is if you must translate a character
string into the null value. For example, if your input data file uses a sequence
of blanks to indicate a null value, you must use the second form if you want
to instruct dbload to substitute null at every occurrence of the blank-
character string.