SORT-MERGE/XL Programmer's Guide (32650-90884)

28 Chapter2
Creating Core Routines That Sort and Merge
Initializing a Sort or Merge
Specifying Data and Sequence
If your key is a character or byte data type, you may use the
altseq
parameter to specify
two things.
The data type of your input key.
The collating sequence (sort order) you want the sort to follow.
The
altseq
parameter is an array with two parts. The first element of the array is defined
by the following table.
The second element of
altseq
specifies the number of characters in the collating sequence.
Remember that SORT-MERGE/XL begins counting on zero, and so you subtract one from
the ordinary counting number. For example, ASCII has 256 characters, so the example
below specifies the value 255.
The example at the end of this chapter uses ASCII input and ASCII sequence. The
following is the part of the example that specifies the input data type and sorting
sequence.
The
altseq
parameter is used only for byte data types The most common are ASCII and
EBCDIC. Refer to Chapter 4 for information about alternate collating sequences, like one
you design yourself or one of the predefined Native Language types.
Collating Sequence:
ASCII EBCDIC ALTERNATE
Data Type: ASCII CHR(255) CHR(2) CHR(0)
EBCDIC CHR(1) CHR(255) Undefined
var
altseq : array [1..2] of CHAR;
.
.
.
altseq[1] := CHR(255); {data = ASCII, }
{sequence = ASCII}
altseq[2] := CHR(255); {256 characters in ASCII}