z/OS DFSMS Using Data Sets
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


Key-Sequenced Data Sets

z/OS DFSMS Using Data Sets
SC23-6855-00

In a key-sequenced data set, logical records are placed in the data set in ascending collating sequence by a field, called the key. Figure 1 shows that the key contains a unique value, such as an employee number or invoice number, that determines the record's collating position in the data set.
Figure 1. Record of a Key-Sequenced Data Set

The key must be in the same position in each record, the key data must be contiguous, and each record's key must be unique. After it is specified, the value of the key cannot be altered, but the entire record can be erased or deleted. For compressed data sets, the key itself and any data before the key will not be compressed.

When a new record is added to the data set, it is inserted in its collating sequence by key, as shown in Figure 2.
Figure 2. Inserting records into a key-sequenced data set
Table 1 lists the operations and types of access for processing key-sequenced data sets.
Table 1. Key-sequenced data set processing
Operation Sequential Access Direct or Skip-Sequential Access
Loading the data set Yes No
Adding records Yes (records must be written in key sequence) Yes (records are added randomly by key)
Retrieving records Yes (records are returned in key sequence) Yes (by key)
Updating records Yes Yes
Deleting records Yes Yes

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014