The following example uses the ALTER command to change the FREESPACE
specification when loading a data set.
Assume that a large key-sequenced data set is to contain records
with keys from 1 through 300␠000. It is expected to have
no inserts in key range 1 through 100␠000, some inserts
in key range 100␠001 through 200␠000, and heavy
inserts in key range 200␠001 through 300␠000.
An ideal data structure at loading time would be:
Key Range |
Free Space |
---|
1 through 100␠000 |
None |
100␠001
through 200␠000 |
5% control area |
200␠001
through 300␠000 |
5% control interval
and 20% control area |
You can build this data structure as follows:
- DEFINE CLUSTER and do one of the following:
- Omit the FREESPACE parameter
- Specify FREESPACE (0 0)
- Specify DATACLAS and use the FREESPACE attribute assigned through
the automatic class selection routines established by your storage
administrator.
- Load records 1 through 100␠000 with REPRO or any user
program using a sequential insertion technique.
- CLOSE the data set.
- Change the FREESPACE value of the cluster with the access method
services command ALTER clustername FREESPACE (0 5). Explicit
specification of FREESPACE overrides the data class attribute assigned
by your storage administrator.
- Load records 100␠001 through 200␠000 with
REPRO or any user program using a sequential insertion technique.
- CLOSE the data set.
- Change the FREESPACE value of the cluster with the access method
services command ALTER clustername FREESPACE (5 20).
- Load records 200␠001 through 300␠000 with
REPRO or any user program using a sequential insertion technique.
This procedure has the following advantages:
- It prevents wasting space. For example, if FREESPACE (0 10) were
defined for the whole data set, the free space in the first key range
would all be wasted.
- It minimizes control interval and control area splits. If FREESPACE
(0 0) were defined for the whole data set, there would be a very large
number of control interval and control area splits for the first inserts.