FastSort Manual

Using FastSort Commands
FastSort Manual429834-003
3-13
EXIT Command
Key Fields
The order in which you enter DESCENDING and ASCENDING commands determines
their relative significance. The first command has the highest priority. SORTPROG
starts sorting the records according to the key fields specified in the first
DESCENDING or ASCENDING command, then uses the key fields specified in the
second DESCENDING or ASCENDING command, and so on.
If two or more records have equal values in the first key field specified in a
DESCENDING or ASCENDING command, the values of the second key field, if
specified, determine the sorted order of the records. If the records have equal values in
the second or any successive key field, the values of the next key field, if specified,
determine the sorted order. If all key-field values of two or more records are equal,
SORTPROG writes or returns those records in the same order it received them.
When you specify the KEYS parameter of the TO command, the output records consist
of only key-field values. SORTPROG concatenates the values. SORTPROG considers
all records as fixed length if you specify the KEYS parameter. If a key field extends
beyond the end of a variable-length record in a structured output file, SORTPROG
pads the key values with blanks.
SORTPROG can compare a key field at the end of a short record if the record contains
the first byte of the key value, unless the field type is REAL, SIGNED TRAILING
EMBEDDED, or SIGNED TRAILING SEPARATE. For comparison of these types of
data, key fields must contain complete values.
You can specify up to 63 key fields for a single sort or merge run. The fields can be
contiguous, noncontiguous, and overlapping. The minimum field length is one column
except for the REAL data type, which is either 4 or 8 bytes. The maximum field length
is the length of the record unless you define the length otherwise.
Examples
DESCENDING 72:80 STRING, 1 FOR 3 INTEGER
DESC 20 FOR 8 UPPER
DESC 1:10,5:20 ! Overlapping key fields, both STRING
DESCENDING 28:34 SLS
DESC 1:10 UNSIGNED ! Keys of a key-sequenced file
EXIT Command
Use the EXIT command to end an interactive FastSort session. Ctrl-Y also ends a
FastSort session.
EXIT