
Utilities 7-21
How to Create a Command File
How to Create a Command File
Beforeyouuse dbload,youfirstcreateanASCIIcommand file thatnamesthe
input data files and the tables that receive the data. The command file maps
fields from one or moreinput files intocolumns ofone ormoretables 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
statementnames a table thatwillreceivethedata.TheINSERT statementalso
defines how dbload will place the data described in the FILE statement into
the columns of the table.
Within thecommandfile,theFILE statementcanappearinthe 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 formatis typical of datarowswith variable-length fields. You
can alsouse thedelimiter formof theFILE statement withfixed-length fields
as long asthe datarowsmeet the delimiterand NEWLINE requirements. The
delimiterform of FILEandINSERT iseasiertouse than thecharacter-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
stringintothenullvalue. For example, if yourinputdatafileusesasequence
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.
Comentarios a estos manuales