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

Chapter 4 53
Altering the Collating Sequence
Altering the Sequence
Altering the Sequence
You can specify an alternate sequence in the
altseq
parameter of the HPSORTINIT or
HPMERGEINIT intrinsic. (The default sequence is ASCII.) Only ASCII type is allowed to
request alternate sequences; when you specify an alternate collating sequence, you must
set the
keys
parameter data type to zero (byte data).
The
altseq
parameter accepts a array.
The first element of the array is set by the following table. The rows of the table show the
type of data you are sorting, and the columns of the table show the type of sequence you
want. For alternate sequences, set the first element of the
altseq
parameter to CHR(0).
In the second element of the array, specify a number one less than the total number of
characters in the collating sequence (
n
1). ASCII has 256 characters, for example, so for
ASCII (the default), the second element would be CHR(255).
If the first element is CHR(0), the rest of the elements of the
altseq
parameter array
contain your actual collating sequence. The collating sequence may be explicitly specified
or read from a file. The sequence must start in the third element of the
altseq
array.
You can create a file that contains a collating sequence, using the SORT/XL or MERGE/XL
utilities. For example, if you want to create the collating sequence mentioned above
(AaBbCc ... ) with the SORT/XL utility, you would do the following:
:FILE DISPLOUT=ALTSEQ,NEW; SAVE; REC=-80,,F,ASCII; DEV=DISC
:RUN SORT.PUB.SYS
>DATA IS ASCII, SEQUENCE IS ASCII
>ALTSEQ MERGE "A-Z" with "a-z"
>SHOW TABLE, OFFLINE
>EXIT
Now you have created an ASCII file named ALTSEQ that contains the new collating
sequence in a table, a decimal list, and an octal list.
Edit the file to contain only the decimal list of the sequence. From your sorting or merging
program, read in the sequence from the file ALTSEQ, and put the character
representations of the values into elements 3-258 of the parameter
altseq
.
For more information about using SORT-MERGE/XL to create alternate collating
sequences, refer to SORT-MERGE/XL General User's Guide.
Collating Sequence:
ASCII EBCDIC ALTERNATE
Data Type: ASCII CHR(255) CHR(2) CHR(0)
EBCDIC CHR(1) CHR(255) Undefined