SORT Engine Environment Variables

This topic lists environment variables that relate to the sorting functionality.

MFJSENGINE
Specifies which sort engine the utility MFJSORT is to emulate.
Syntax
MFJSENGINE={DFSORT|SYNCSORT}
Parameters
DFSORT
MFJFSORT emulates the mainframe DSORT utility.
SYNCSORT
MFJFSORT emulates the SYNCSORT utility.
Default
MFJSENGINE=DFSORT
Related information
MFJSDCBOUTFIL [11]
Determines whether the DCB's LRECL value is honored during an OUTFIL statement.
MFJSDCBOUTFIL={ON|OFF}
Parameters
ON
The LRECL specified in the DCB properties is used during an OUTFIL statement.
OFF
Emulates the ICE222A/ICE217A mainframe restriction.
Default
MFJSDCBOUTFIL=OFF
Comments
When MFJSDCBOUTFIL=ON is in effect, if the DCB LRECL value differs from that calculated by OUTFIL, records are either truncated or padded with space to match the DCB LRECL value.
Example
MFJSDCBOUTFIL=ON
MFJSTATS

For a COBOL sort not running under mainframe emulation, setting the environment variable MFJSTATS to ON creates a report containing statistics for the SORT that is displayed to SYSOUT. If a report file already exists for a previous SORT, the new statistics are appended to the end of the previous one.

If you are performing a COBOL sort using mainframe emulation, you can create a statistics report by modifying the JCL statement.

Syntax

Windows:
SET MFJSTATS=switch
UNIX:
MFJSTATS=switch
export MFJSTATS

Parameters

switch Switches report creation ON or OFF. The default is OFF.

SORTCOMPRESS
Tells the system whether or not to execute a compression routine on each record to be sorted.

Syntax

Windows:
SET SORTCOMPRESS=n
UNIX:
SORTCOMPRESS=n
export SORTCOMPRESS

Parameters

n - An integer that indicates if compression is enabled or not. 0 (zero, the default) indicates not enabled; any positive integer indicates enabled. When enabled, it allows for run-length encoding of sort records, resulting in much better performance when records contain multiple repeated characters.

Comments

This variable is recommended if the sort records contain many single repeated characters, for example, multiple spaces, as it can be very effective in improving memory usage and therefore sort performance.

Example

Windows:
SET SORTCOMPRESS=5
UNIX:
SORTCOMPRESS=5
export SORTCOMPRESS
SORTSCHEME
Activates a sortscheme. Use in conjunction with SORTSPACE for improved performance.

Syntax

Windows:
SET SORTSCHEME=1
UNIX:
SORTSCHEME=1
export SORTSCHEME
Values
  • SORTSCHEME=1 - this is the only valid value for the environment variable. See SORTSPACE for more information.
SORTSPACE
The amount of memory to be allocated to internal workspace for SORT operations. This can be specified in different formats: for example, you could specify 64M, 2G, and 1000000 to give sort memory areas of 64 Megabytes, 2 Gigabytes and 1000000 bytes respectively.

Syntax

Windows:
SET SORTSPACE=n[K|k|M|m|G|g]
UNIX:
SORTSPACE=n[K|k|M|m|G|g]
export SORTSPACE

Parameters

n[K|k|M|m|G|g The amount of memory to be allocated to internal workspace for SORT operations. K or k indicates kilobytes, M or m indicates megabytes and G or g indicates gigabytes. No letter indicates bytes. Defaults to 1 megabyte.

Comments

A larger value for SORTSPACE will generally result in a faster sort. However, if you specify a value that exceeds the capacity of main memory in your computer, such that the operating system has to page memory in and out, performance will be degraded.

Example

Windows:
SET SORTSPACE=1024K
UNIX:
SORTSPACE=1024K
export SORTSPACE

SORTTEMPSPACE
Specifies the amount of memory to be allocated to temporary workspace for SORT operations.

Syntax

Windows:
SET SORTTEMPSPACE=n[K|k|M|m|G|g]
UNIX:
SORTTEMPSPACE=n[K|k|M|m|G|g]
export SORTTEMPSPACE

Parameters

n[K|k|M|m|G|g] The amount of memory to be allocated to temporary workspace for SORT operations. K or k indicates kilobytes, M or m indicates megabytes and G or g indicates gigabytes. No letter indicates bytes. 32 megabytes is the lowest amount of memory that can be allocated.

Comments

The memory allocation strategy used by SORT can be adjusted through use of SORTTEMPSPACE, which generally improves performance in systems suffering from memory fragmentation.

Example

Windows:
SET SORTTEMPSPACE=250MB
UNIX:
SORTTEMPSPACE=250MB
export SORTTEMPSPACE
SORTTYPE
Defines the sort type.

Syntax

Windows:
SET SORTTYPE=2
UNIX:
SORTTYPE=2
export SORTTYPE
Values
  • SORTTYPE=2 Forces SORT to use the file handler, so that format modifications are picked up from the extfh.cfg file.
  • Not setting this variable means that SORT will try to use CBL_ routines to read and write files to improve performance.
Note: 2 is the only valid value for this environment variable.