importdb - Import Comma-Delimited File

importdb [-a|-n] [-brlLftudcweCSV] dataarea|dataID filename comma-delimitedfile

Load a comma-delimited flat file into a database file.

The fields in the CSV file must be in the same order as in the database definition unless you use the -f option. If the fields in the CSV file contain any special characters, you should enclose the field's value in quotes.

You can use Application Development Workbench or Environment 4GL to paint a report, and then use the report to create a comma-delimited export file. If you send the report output to a spreadsheet program when you interpret the report, the system writes only the fields in the detail format to the spreadsheet file. Application Development Workbench (or Environment 4GL) writes the fields to the spreadsheet file in the order that they are in on the report. You can only build the spreadsheet file interpretively.

The advantages of this method of building an export file are that you determine the order of the fields in the file and that you can move selected records to the file. You can then use importdb to import the file.

For loading data from attachment tables, use the dbload or impexp system utilities.

See dbload - Load a Database from a Flat File.

See impexp - Import an Export File.

See the information on attachment tables in Lawson 4GL Application Program Interfaces/Lawson RPG Application Program Interfaces.

See the information on dumping and loading data files in Infor Lawson Administration: Data Access.

See the information on copying data and other objects in Infor Lawson Administration: Server Setup and Maintenance.

Program Option Description
-a Overwrite all duplicate records. Replaces existing database records with duplicate records in the flat file. If the flat file has multiple occurrences of a record, the last occurrence is stored in the database.
-n Do not overwrite duplicate records. Does not replace existing database records with the duplicate records from the flat file. It ignores the duplicate records in the flat file.
-b Batch inserts based on INSERTBUFSIZE.
-r Report on duplicate records. Prints duplicate records between the flat file and the database.
-l Log duplicate records.
-L Log modified and duplicate records.
-f File has field headers.
-t Tabs treated as separator value; default is Space.
-u Update records; valid with -f option only.
-d Do not reformat dates. Files in database format.
-c

Correct records. Valid with the -u and -f options only.

Enforces strict data type casting. For example, the data type alpha converts to uppercase, and a leading zero is added to floating point fields (.12 ? 0.12). The default enforces strict data type casting.

-w Generate data type casting warnings. Overwrites the -c option.
-e Halt program on any data or database error.
-V Display the version number of this utility.
-C

Configures importdb to use the date format, decimal separator, and thousands separator set in locdef.

Valid with the -f option only.

-S

Specifies the delimiter used in the import file if the default delimiter is not used.

Requires the delimiter to be in a two-digit hexadecimal ASCII value. For example, if the user used semicolon as delimiter, the syntax would be -S3B. The delimiter must also be a different character from the one used for the decimal and thousands separator.

At the command line, specify the information above.

- or -

  1. From the Database Administration menu, choose Data Export/Import.

  2. From the Data Export/Import menu, choose Import Comma-Delimited File.

  3. Specify or select the following data.

    Program Options
    See program options above.
    Note: If you access importdb through a menu or by transferring to it, use the -a or -n option. These options prevent requests for user responses that cannot be handled in this mode. Run importdb from the command line if you do not want to use the -a or -n option.
    Data Area/Data ID
    Data area or data ID to import a comma-separated-value file into.
    File Name
    File you want to load. Leave blank to load the entire product line.
    Comma-Delimited File
    Comma-delimited file to load the database files from.
    I/O Options
    Optional. Display the output or redirect it to a file.
  4. Press Enter.

Note: Date, time, user name, type, utility name, and key field activities of this utility are logged in the $LAWDIR/system/secadmin.log file.

Files created on different platforms such as Windows and Unix/Linux use different line endings. Windows uses a pair of carriage return and line feed ("\r\n") as the line ending. For Unix/Linux, only a line feed ("\n") is used. Files created from a different platform must be converted before importing.