You are here: Job and Form Set Rules Reference > JDT Rules Reference > SortBatches > Sorting with a Single Key

Sorting with a Single Key

To make it easier to set up and to support external sorts with only one key, a sort file with the with single key prepended is written and sorted by the external sort program when you use the BuildSortKey option. The batch file is written in the specified order without the prepended keys. The descending option (d) does not work with an external sort that does not support binary sorting.

Here is an example of how to set up your INI options for a single key sort. You specify the format of the external sort command using the options in the SortBatchOptions control group. This example calls the Windows command line sort:

< SortBatchOptions >

BuildSortKey = Yes

SortCommand = SORT **SourceFile** /t **WorkPath** /o **TargetFile**

Note The default for the BuildSortKey option is Yes on Windows and No on other platforms.

This is the default sort for running under Windows. “**SourceFile** /t **WorkPath** /o **TargetFile**” are replacement strings that are replaced with the appropriate values when the command line string is created. See Replacement Strings for a complete list of available replacement strings.

These SortBatchOptions would produce the following sort command:

SORT .\data\REGPRT.tmp /t .\data\ /o .\data\REGPRT.wrk