The DUPLICATES option indicates whether two or more data 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 setting NO DUPLICATES is assumed by default. The DUPLICATES options for Accesses are explained in DUPLICATES Options for Accesses.
When the INDEPENDENTTRANS option is set and either the DUPLICATES FIRST option or DUPLICATES LAST option is specified, only the current transaction for a single 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.
The single abort process occurs concurrently with and is treated like any database application. Thus, from the perspective of an Access, when SINGLEABORT recovery inverts a DELETE, that action becomes a new entry and is inserted in the Access 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.
Table 15. DUPLICATES Options for Accesses
Option |
Description |
---|---|
When the NO DUPLICATES option is specified, all data set records must have unique keys. The key of an existing record cannot be changed when the NO DUPLICATES option is stipulated. The key can only be changed by deleting the record from the data set and then re-creating it with a new key. |
|
The DUPLICATES FIRST option causes records with identical keys to be kept in reverse chronological order; that is, the first record returned is the one most recently added, the second record returned is the next most recently added, and so on. |
|
The DUPLICATES LAST option causes records with identical keys to be kept in chronological order; the first record returned is the first record added, the second record returned is the second record added, and so on. |
|
If neither the FIRST nor LAST keyword is specified, duplicates are not returned in any specific order. |
Valid values for the DUPLICATES option depend upon the type of data set being referenced, as follows:
-
Direct data sets can designate only the NO DUPLICATES option.
-
Ordered data sets can designate the DUPLICATES, DUPLICATES FIRST, DUPLICATES LAST, or NO DUPLICATES options.
-
Random data sets can designate the DUPLICATES or NO DUPLICATES options.
Table 16. DUPLICATES Options Available with Accesses
Direct |
Random |
Ordered |
|
---|---|---|---|
NO DUPLICATES |
Yes |
Yes |
Yes |
DUPLICATES FIRST |
No |
No |
Yes |
DUPLICATES LAST |
No |
No |
Yes |
DUPLICATES |
No |
Yes |
Yes |