z/OS DFSMS Access Method Services Commands
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


Calculating Virtual Storage Space for an Alternate Index

z/OS DFSMS Access Method Services Commands
SC23-6846-01

When BLDINDEX builds an alternate index, access method services opens the base cluster to sequentially read the data records, sorts the information obtained from the data records, and builds the alternate index records:

  1. The base cluster is opened for read-only processing. To prevent other users from updating the base cluster's records during BLDINDEX processing, include the DISP=OLD parameter in the base cluster's DD statement. If INDATASET is specified, access method services dynamically allocates the base cluster with DISP=OLD.
  2. The base cluster's data records are read and information is extracted to form the key-pointer pair:
    • When the base cluster is entry-sequenced, the alternate key value and the data record's RBA form the key-pointer pair.
    • When the base cluster is key-sequenced, the alternate key value and the data record's prime key value form the key-pointer pair.

    If the base cluster's data records can span control intervals the alternate key must be in the record's first control interval.

  3. The key-pointer pairs are sorted in ascending alternate key order. If your program provides enough virtual storage, access method services does an internal sort. (The sorting of key-pointer pairs takes place entirely within virtual storage.)

    Use the following process to determine the amount of virtual storage required to sort the records internally:

    1. Sort record length = alternate key length + (prime key length (for a key-sequenced data set) or 4 (for an entry-sequenced data set)).
    2. Record sort area size = either the sort record length times the number of records in the base cluster rounded up to the next integer multiple of 2048 (the next 2K boundary), or a minimum of 32768, whichever is greater.
    3. Sort table size = (record sort area size/sort record length) x 4.
    4. The sum of b + c = required amount of virtual storage for an internal sort. (The amount for an internal sort is in addition to the normal storage requirements for processing an access method services command.)
    If you do not provide enough virtual storage for an internal sort, or if you specify the EXTERNALSORT parameter, access method services defines and uses two sort work files and sorts the key-pointer pairs externally. Access method services uses the sort work files to contain most of the key-pointer pairs while it sorts some of them in virtual storage. An external sort work file is a VSAM entry-sequenced cluster, marked reusable. The minimum amount of virtual storage you need for an external sort is:
    • 32768 + ((32768/sort record length) x 4)

    The amount of space that access method services requests when defining each sort work file is calculated as follows:

    1. Sort records per block = 2041/sort record length
    2. Primary space allocation in records = (number of records in base cluster/sort records per block) + 10
    3. Secondary space allocation in records = (primary space allocation x 0.10) + 10

    Both primary and secondary space allocation are requested in records with a fixed-length record size of 2041 bytes. The control interval size is 2048 bytes.

    There must be enough space on a single DASD volume to satisfy the primary allocation request; if there is not, the request fails. To correct the problem, specify the volume serial of a device that has sufficient space (see DD Statements That Describe the Sort Work Files).

  4. When the key-pointer pairs are sorted into ascending alternate key order, access method services builds an alternate index record for each key-pointer pair. If the NONUNIQUEKEY attribute is used and more than one key-pointer pair has the same alternate key values, the alternate index record contains the alternate key value, followed by the pointer values in ascending order. If the UNIQUEKEY attribute is used, each alternate key value must be unique.
    When the record is built, it is written into the alternate index as though it is a data record loaded into a key-sequenced data set. The record's attributes and values, specified when the alternate index is defined, include:
    • BUFFERSPACE
    • CONTROLINTERVALSIZE
    • DATACLASS
    • FREESPACE
    • RECORDSIZE
    • RECOVERY
    • SPEED
    • WRITECHECK
  5. When all alternate index records are built and loaded into the alternate index, the alternate index and its base cluster are closed. Steps 1 through 4 are repeated for each alternate index that is specified with the OUTFILE and OUTDATASET parameter. When all alternate indexes are built, any defined external sort work files are deleted. Access method services finishes processing and issues messages that show the results of the processing.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014