The DUPLICATES option applies only to index random, index sequential, and ordered list sets. The DUPLICATES option indicates whether two or more set records can have identical keys. If duplicates are allowed, this option also controls the order in which records with duplicate keys are returned. The default setting is NO DUPLICATES. Note that SETS and SUBSETS have different defaults.
The DUPLICATES option affects the space required by the set and the time required to access it. If duplicates are allowed, but neither FIRST nor LAST is stipulated, a 1-word duplicate resolver is added to each set entry. The duplicate resolver makes each set entry unique and allows a binary search to be done to retrieve a particular record. If the DUPLICATES FIRST option or the DUPLICATES LAST option is specified, no duplicate resolver is allocated. When a particular record is required, the first record with the specified key is located and the remaining entries with equal keys are searched for in linear fashion.
Thus, the DUPLICATES FIRST and DUPLICATES LAST options dictate that the data set entries be stored in chronological order. However, this ordering can be altered if transactions are aborted. When the INDEPENDENTTRANS option is set and either the DUPLICATES FIRST option or DUPLICATES LAST option is specified, only the current transaction for the aborting program is affected. The audit is processed in reverse order and performed operations are inverted. For example, a DELETE operation becomes a CREATE operation and a STORE operation. All other programs continue to process normally.
This reversal of operations can cause the chronological ordering of the records to change. The single abort process occurs concurrently with and is treated like any database application. Thus, from the perspective of a set, when SINGLEABORT recovery inverts a DELETE, that action becomes a new entry and is inserted in the set as the then most current FIRST or LAST entry. As such, the entries pointing to restored data set records can change their chronological position within a group of duplicates.
The DUPLICATES options for sets are explained in DUPLICATES Options for Sets.
Table 12. DUPLICATES Options for Sets