When you have a Db2 Table with an IDENTITY column defined as follows:
CREATE TABLE PREFIX.TABLE_NAME
(COL_1 DECIMAL(10, 0)
NOT NULL
,COL_2 SMALLINT
NOT NULL
GENERATED ALWAYS AS IDENTITY ( START WITH 1
, INCREMENT BY 1
, MINVALUE 1
, MAXVALUE 32767
, CYCLE
, CACHE 20
, NOORDER )
...
FASTUNLOAD
...
LOAD-CONTROL DB2LOAD
LOAD DATA INDDN SYSREC01
...
INTO TABLE PREFIX.TABLE_NAME
IGNOREFIELDS YES
(
COL_1 POSITION( 1: 6 )
DECIMAL PACKED
,
DSN_IDENTITY POSITION( 7: 8 )
SMALLINT
...
The FASTUNLOAD parameter LOAD-CONTROL DB2LOAD generates a name DSN_IDENTITY for the field that do not match the column together with this syntax:
IGNOREFIELDS YES
See the IBM LOAD utility documentation:
IGNOREFIELDS
Indicates whether LOAD is to skip fields in the input data set that do not correspond to
columns in the target table. Examples of fields that do not correspond to table columns are
the DSN_NULL_IND_nnnnn, DSN_ROWID, DSN_IDENTITY, and DSN_RCTIMESTAMP fields
that are generated by the REORG utility.
NO
Specifies that the LOAD process is not to skip any fields.
YES
Specifies that LOAD is to skip fields in the input data set that do not correspond to columns in the
target table.
Specifying YES can be useful if each input record contains a variable-length field, followed by
some variable-length data that you do not want to load and then some data that you want to
load. Because of the variable-length field, you cannot use the POSITION keyword to skip over the
variable-length data that you do not want to load. By specifying IGNOREFIELDS, you can give a
field specification for the variable-length data that you do not want to load; and by giving it a name
that is not one of the table column names, LOAD skips the field without loading it.
Use this option with care, because it also causes fields to be skipped if you intend to load a
column but have misspelled the name.
The column is an IDENTITY column so the data will be generated as per this clause:
GENERATED ALWAYS AS IDENTITY ( START WITH 1
, INCREMENT BY 1
, MINVALUE 1
, MAXVALUE 32767
, CYCLE
, CACHE 20
, NOORDER )
FASTUNLOAD
...
LOAD-CONTROL FASTLOAD,IGNOREGA
Fast Load utility can load data from the unloaded data set with the IGNOREGA YES parameter and the field name will match the column name. The load syntax would be fine using this FASTLOAD statement (Note the IBM LOAD utility does not support this feature).
FASTLOAD INDDN SYSULD
...
IGNOREGA YES
INTO TABLE TABLE_NAME
(
COL_1 POSITION( 1: 6 )
DECIMAL PACKED
,
COL_2 POSITION( 7: 8 )
SMALLINT
...