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

26 Chapter2
Creating Core Routines That Sort and Merge
Initializing a Sort or Merge
parameter and give key information in the
keys
parameter.
The part of the core routine example at the end of the chapter that specifies keys is:
The
keys
parameter is an integer array; each key contains four elements you specify. The
elements are:
Beginning byte position of the key.
Number of bytes in the key.
Ordering sequence (0 for ascending, 1 for descending)
Type of data to be sorted by the key. See types below:
NOTE
Language equivalents of the following data types are given in Appendix E.
0 Byte (usually used).
If the key is ASCII or EBCDIC, it is byte type. With byte type, element 2 of
keys
contains the number of characters in the key.
1 twos complement format (integer).
This type is used for shortint (2-byte) or integer (4-byte) keys.
2 HP 3000 floating point.
This type is used for data that is in MPE V/E floating point format. This
type is used for 4-byte and 8-byte real numbers.
3 IEEE standard floating point.
This type is used for data in the MPE XL floating point format. This type is
used for 4-byte, 8-byte, or 16-byte real numbers.
4 Packed decimal with odd number of digits.
This is a COBOL data type.
5 Packed decimal with even number of digits.
This is a COBOL data type.
6 Display trailing sign.
var
num_keys : INTEGER;
keys : array [1..4] of INTEGER;
.
.
.
num_keys := 1;
keys [1] := 1 {key begins}
keys [2] := 20; {key length}
keys [3] := 0; {byte data }
keys [4] := 0; {ascending order}