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

Chapter 2 29
Creating Core Routines That Sort and Merge
Initializing a Sort or Merge
Using HPSORTINIT
The following code segment demonstrates the the HPSORTINIT intrinsic. The parameters
used are those already discussed.
Using HPMERGEINIT
The following code segment demonstrates the HPMERGEINIT intrinsic. The parameters
used are those already discussed.
var
status : INTEGER;
inputfiles : array [1..3] of INTEGER;
outputfile : array [1..2] of INTEGER;
outputoption : INTEGER;
NumKeys : INTEGER;
keys : array [1..4] of INTEGER;
altseq : array [1..2] of CHAR;
inputfiles[1] := tempFileNum; {from HPFOPEN}
inputfiles[2] := permFileNum: {from HPFOPEN}
inputfiles[3] := 0;
outputfile[1] := outFileNum; {from HPFOPEN}
outputfile[2] := 0;
outputOption := 0; {output record format same}
{ as input record format }
numKeys := 1; {one key}
keys[1] := 1; {key begins}
keys[2] := 20; {key length}
keys[3] := 0; {byte data}
keys[4] := 0; {ascending order}
altseq[1] := CHR(255); {data = ASCII and}
{sequence = ASCII}
altseq[2] := CHR(255); {256 characters in ASCII}
HPSORTINIT (status, inputfiles, outputfile,
outputOption,,, numKeys, keys, altseq,,,,,);