Work Files

The work file size is provided explicitly or implicitly by your program. SORT first determines the desired block size and then computes the number of disk rows provided by you. The maximum number of rows that SORT allocates to the work file is 183; partial rows are rounded up to a full row. Row sizes do not exceed 1,320 segments unless an extremely large amount of disk is provided. When a restartable sort is requested, file equation should be used to give a unique title to the work file. For example:

<i> FILE DISKF (TITLE=JOBNAME/SORTWORK)

A new BLOCKSIZE and MAXRECSIZE can be provided in the file equation for the work file. Other attributes in the file equation for the work file can be modified, but the probability of failure is high when attributes such as AREAS and AREASIZE are modified by file equation.

The BLOCKSIZE and MAXRECSIZE attributes must be compatible in order to open the file. Modifying the buffer size overrides the normal memory allocation algorithms of SORT. However, care should be exercised when these values are changed. When the buffer size is increased, the number of disk segments per disk row is proportionately increased, and SORT proceeds using the larger disk rows. If the buffer size is decreased, the number of disk segments per disk row is proportionately decreased, which might result in a work file that is not large enough to accomplish the sort. One method of alleviating this condition is to specify a larger quantity of disk space. Modification of the buffer size is usually less effective than providing a different memory size for use by SORT. However, sort operations are always data-dependent, and with some ordering of data, a better sorting can be obtained by judicious selection of buffer size.