This variable specifies the number of 64KB blocks of memory that the SORT statement will try to allocate when it executes. The acceptable range is from 1 to 16384. The default value is 32. This variable, SORT_MEMORY is no longer valid begginning in Version 10. Using a value lower than the default can be useful if memory is tight on the host machine. Using a higher value may enhance SORT performance.

Take care, when increasing the SORT_MEMORY setting, to ensure that you do not assign too much memory to the runtime. For most operating systems, the memory used by SORT is not returned to the system after the SORT completes. While the runtime may use the memory for other purposes, this memory is not available to other programs until the runtime exits. Because of this, you may want to isolate a large SORT operation into its own program, run by a temporary runtime process, so that once the process exits, the memory is returned to the operating system.

The SORT statement will attempt to allocate the amount of memory specified in SORT_MEMORY. If the requested amount is not available, the runtime will return an out of memory error.