DISCARDS


The DISCARDS option defines the limit on the number of discard violations (see the description of discard violations in this topic).
 

DISCARDS.png

When LOADPLUS reaches the specified limit, the load job terminates.

The default is 0 (no limit) when you do not specify the DISCARDS keyword. When you specify the DISCARDS keyword, you must supply a value and this value must be an integer (which can be 0).

You can also specify a user-defined return code for LOADPLUS to use when you reach this limit. (See IFDISCARDLIMIT.)

Additional considerations

The following considerations apply to this option:

  • When invoking DSNUTILB, LOADPLUS passes this option to the IBM Db2 LOAD utility for processing.
  • Unless you are running an SQLAPPLY load job, this option is not valid for a single-phase load (PRELOAD LOAD) when you specify LOAD RESUME YES.
  • For a two-phase load, a value greater than 0 for this option is meaningful only with one of the following options:

    • UNIQUECHECK YES (which is the default)
    • UNIQUECHECK CLUSTER when all participating unique indexes are data-sorting indexes

    For information, see UNIQUECHECK.

Discard violations

Discard violations are calculated as the total number of violations that cause LOADPLUS to discard input records during the PRELOAD or COMBINED phase for a particular load job. For example, if two input records are duplicates and they both violate a check constraint, LOADPLUS reports four discard violations (assuming that you did not specify IGNORE DUPKEY or IGNORE CHKC). In this case, however, the SYSDISC data set contains only the two discarded input records.

LOADPLUS generates discard violations for any of the following reasons:

  • An input value position is past the end of the input record.
  • An input value is not entirely contained in the input record.
  • A data conversion error (including a FIELDPROC error) occurs.
  • A value generated for an identity column is out of range.
  • A verification record does not match the table that is being loaded (FORMAT BMCUNLOAD).
  • LOADPLUS encounters an error byte during data translation.
  • LOADPLUS encounters a substitution character during data translation, but you specified NOSUBS.
  • An expansion error occurs during data translation.
  • A VALIDPROC violation occurs.
  • A record does not match any WHEN specification or table OBID.
  • A record does not match any partition that is being loaded.
  • A Db2 check constraint violation occurs.
  • A Db2 referential constraint violation occurs.
  • An informational referential constraint violation occurs (and INFORI is YES).
  • A unique key violation occurs in the PRELOAD or COMBINED phase.
  • An SQLCODE -330, -530, or -803 occurs during an SQLAPPLY load.
  • A problem occurs with a referenced file that is used to load LOB or XML data.
  • A problem occurs with an XML document.
  • A conversion error occurs on a key that is derived from an expression.

Records in the cases described in the following table are discarded but not recorded as discard violations. The discarded records are not written to the discard data set, and they do not count toward the DISCARDS limit.

Condition

Type of discarded records not written to SYSDISC

Input data set is a pipe

Records that meet any of the listed discard criteria

UNIQUECHECK NO specified for a two-phase load job

Duplicate records

UNIQUECHECK CLUSTER specified for a two-phase load job

Duplicates in non-data-sorting indexes

LOADPLUS evaluates the same input file for multiple INTO statements

Input records that are valid for at least one INTO statement, but not all INTO statements

IGNORE

The IGNORE option tells LOADPLUS to ignore the specified discard types during the PRELOAD phase or the COMBINED phase. If the specified type of discard occurs, LOADPLUS

  • Does not write an error record to the SYSERR data set (unless the discard is a duplicate key error or referential constraint violation)
  • Does not report the error in the error summary report (unless the discard is a referential constraint violation)
  • Does not write the corresponding input record to the discard data set (unless the record also violates another discard type)

An ignored discard violation does not count toward the DISCARDS limit.

Important

If you use MSGLEVEL(1), LOADPLUS issues messages BMC51501E, BMC51502E, BMC51503E, BMC51505E, and BMC51506E to help diagnose problems regardless of the IGNORE option.

The IGNORE option is especially useful for WHEN and PART discards when all records in your input file do not participate in the load.

The following table lists the keywords and discards types, along with their descriptions, that you can specify with the IGNORE option:

IGNORE keyword

Types of records for which discards are ignored

ALL

Any discards

WHEN

Records that are not selected by any INTO statement or that are discarded as a result of a table or column definition mismatch when specifying FORMAT UNLOAD, FORMAT BMC, or FORMAT BMCUNLOAD

PART

Records that are not selected by any partitions being loaded

FIELDSPEC

Records that are discarded due to an error on the field specification

CONV

Records that are discarded due to an error in conversion

DUPKEY

Records that are discarded due to duplicate keys

VALPROC

Records that are discarded because of a validation procedure

CHKC

Records that are discarded because of check constraints

FRGNKEY

Records that are discarded because of an invalid value in a foreign key

IDERROR

Records that are outside the range that is defined on the identity column

Restriction

This option is not valid when LOADPLUS invokes DSNUTILB. LOADPLUS issues message BMC50178E and terminates.

REPORT

The REPORT option tells LOADPLUS which discard types to report or not report in the error summary report. Although this option has no effect on actual discard processing, it allows you to limit the number of SYSPRINT records when you expect many discards.

Restriction

When invoking DSNUTILB, LOADPLUS ignores this option.

Value

Description

YES

When you specify DISCARDS REPORT YES, the discard types that you specify are reported in the LOADPLUS error summary report. DISCARDS REPORT YES ALL is the default.

LOADPLUS does not report any discard types that you specify with the IGNORE option, even if you specify them in the REPORT YES option.

NO

The discard types that you specify in this option are not reported in the LOADPLUS error summary report. This option is beneficial when you expect many discards.

REPORT NO has no effect on actual discard processing. Depending on the use of the IGNORE option, LOADPLUS still writes error records to the SYSERR data set and still writes corresponding input records to the discard data set.

discardType

The following table lists the keywords and discard types, along with their descriptions, that you can specify with the REPORT option:

Valid discard types used with the REPORT option

REPORT keyword

Types of records for which discards are not reported

ALL

All discards

WHEN

Records that are not selected by any INTO statement or that are discarded as a result of a table or column definition mismatch when specifying FORMAT UNLOAD, FORMAT BMC, or FORMAT BMCUNLOAD

PART

Records that are not selected by any partitions being loaded

FIELDSPEC

Records that are discarded due to an error on the field specification

CONV

Records that are discarded due to an error in conversion

DUPKEY

Records that are discarded due to a duplicate key

VALPROC

Records that are discarded because of a validation procedure

CHKC

Records that are discarded because of check constraints

FRGNKEY

Records that are discarded due to an invalid value in a foreign key

IDERROR

Records that are outside the range that is defined on the identity column

 

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*