FastSort Manual

Optimizing Sort Performance
FastSort Manual429834-003
9-3
Using Scratch Files
Specify a scratch file that does not exist. SORTPROG creates an initial scratch file
on a volume selected by DEFINEs or volume characteristics.
Specify only a volume name. SORTPROG creates an initial scratch file on the
specified volume.
Even when SORTPROG creates a scratch file, the file is sometimes too small to hold
all of the records. For example, an initial scratch file can be too small if the input record
count is smaller than the actual number of input records. In this case, SORTPROG
tries to write to a full scratch file and receives file-system error 45 (FILE IS FULL).
SORTPROG tries to increase the size of the scratch file by increasing the maximum
number of extents until the sort or merge run completes, unless:
SORTPROG runs out of space on the scratch file disk before the scratch file
reaches its maximum limit. SORTPROG then searches for a suitable disk on which
to create an overflow scratch file. For more information, see How Volume
Characteristics Affect Selection on page 9-5.
If there is insufficient overflow scratch space, SORTPROG returns FastSort
error 30 (A WRITE HAS FAILED TO A SCRATCH FILE) along with file-system
error 43 (UNABLE TO OBTAIN DISK SPACE FOR FILE EXTENT) and stops.
A file-system error other than 21 occurs when SORTPROG is trying to increase the
number of extents.
Initial and Overflow Scratch Volumes
An initial scratch volume is the volume FastSort uses first for scratch files. For
example, a volume you specify in the SCRATCH attribute is an initial scratch volume. If
you explicitly specify an initial scratch volume, FastSort uses up to 100 percent of
available disk space on that volume. If FastSort selects an initial scratch volume, it
uses up to 80 percent of available disk space on that volume.
Overflow scratch volumes are volumes FastSort uses as alternate locations for scratch
files, if needed. For example, volumes you specify in the SCRATCHON attribute are
overflow scratch volumes. If you explicitly specify an overflow scratch volume, FastSort
uses up to 100 percent of available disk space on that volume. If FastSort selects an
overflow scratch volume, it uses up to 80 percent of available disk space on that
volume.
Selecting a Scratch Volume for Serial Sorts
This subsection describes how FastSort selects a scratch volume for serial sorts. For
information about subsort scratch files, see Selecting a Scratch Volume for Parallel
Sorts on page 9-7.
When a sort operation requires a scratch file, FastSort reads SORT DEFINEs for
acceptable scratch volumes. If no scratch file or scratch volume is specified in a
Note. FastSort always purges scratch files after a sort or merge runs completes, unless you
sort programmatically and call SORTMERGESTART with flags parameter bit <12> set to 1.