SQL/MX 2.x Reference Manual (H06.10+, J06.03+)

SQL/MX Utilities
HP NonStop SQL/MX Reference Manual544517-008
5-52
Examples of import
This import command imports data into the COMPANY table from the delimited
input file named COINPUT using the format file FORMFILE:
import cat.sch.company -I coinput -U formfile -W DELIM
Example 2 shows an import into the same COMPANY table from a fixed width file.
This example shows the data to be loaded (the input data file), the format file
describing the data, and the import command used to load it.
Data to Input
The input file, COINPUT_FX, contains records like this:
00000000001,"Test String 3456","111-222-3333","444-555-6666"
00000000002,"ibm ","408-111-2222","408-222-3333"
00000000003,"apple ","408-222-1111","408-333-2222"
00000000004,"tandem ","408-285-5000","408-285-2227"
00000000005,"diyatech ","510-111-2222","510-222-3333"
Format File Describing the Data
[DATE FORMAT]
DateOrder=MDY
DateDelimiter=/
TimeDelimiter=:
FourDigitYear=Y
DecimalSymbol=.
[COLUMN FORMAT]
col=id,N
col=company,N
col=phone,N
col=fax,N
[FIXED WIDTH FORMAT]
col=id,1,11
col=company,14,16
col=phone,33,12
col=fax,48,12
RecordLength=61
All commas and double-quote characters in the input file are ignored because they
are not covered by any of the col= entries in the [FIXED WIDTH FORMAT] section
of the format file. Also, in this example the RecordLength value of 61 includes one
newline character at the end of each input record.
import Load Command
This import command imports data into the COMPANY table from the fixed width
input file named COINPUT_FX using the format file FORMFILE:
import cat.sch.COMPANY -i COINPUT_FX -u FORMFILE -w FIXED
Example 3 shows an import into TABLE_2 from a fixed width file with data that is
not separated by double-quote characters. This example shows the schema of the