Reject files

Rows that have conversion errors during a load are written to a reject file on the server that performs the conversion.

The REJECTFILE keyword in the CREATE EXTERNAL TABLE statement determines the name given to the reject file.

Instead of using a reject file, you can use the MAXERRORS keyword in the CREATE EXTERNAL TABLE statement to specify the number of errors that are allowed before the database server stops loading data. (If you do not set the MAXERRORS keyword, the database server processes all data regardless of the number of errors.)

The database server removes the reject files, if any, at the beginning of a load. The reject files are recreated and written only if errors occur during the load.

Reject file entries are single lines with the following comma-separated fields:
file name, record, reason-code, field-name: bad-line
file name
Name of the input file
record
Record number in the input file where the error was detected
reason-code
Description of the error
field-name
The external field name where the first error in the line occurred or <none> if the rejection is not specific to a particular column
bad-line
For delimited or fixed-ASCII files only, the bad line itself

The load operation writes file name, record, field-name, and reason-code in ASCII.

The bad-line information varies with the type of input file:
  • For delimited files or fixed text files, the entire bad line is copied directly into the reject file. However, if the delimited format table has TEXT or BYTE columns, the reject file does not include any bad data. The load operation generates only a header for each rejected row.
  • For Informix® internal data files, the bad line is not placed in the reject file because you cannot edit the binary representation in a file. However, the file name, record, reason-code, and field-name are still reported in the reject file so that you can isolate the problem.
The following types of errors can cause a row to be rejected.
CONSTRAINT constraint name
This constraint was violated.
CONVERT_ERR
Any field encounters a conversion error.
MISSING_DELIMITER
No delimiter was found.
MISSING_RECORDEND
No record end was found.
NOT NULL
A null was found in field-name.
ROW_TOO_LONG
The input record is longer than 2 GB.