SORT-MERGE/XL Programmer's Guide (32650-90884)
Chapter 4 55
Altering the Collating Sequence
Example of Using an Altered Sequence
begin
datafile := '%DATA%';
permanent := 1;
HPFOPEN (dataFileNum, status, designator, datafile, domain, permanent)
;
new := 4;
write := 1;
size := 80;
fruitfile := '%FRUIT%';
HPFOPEN (fruitFileNum, status, designator, fruitfile, domain, new,
access,
write, record_size, size);
end;
Procedure DO_SORT;
var
inputfiles : array [1..2] of INTEGER;
outputfile : array [1..2] of INTEGER;
outputOption : INTEGER;
numKeys : INTEGER;
keys : array [1..4] of INTEGER;
altseq : packed array [1..96] of CHAR;
Begin
inputfiles [1] := dataFileNum;
inputfiles [2] := 0;
outputfile [1] := fruitFileNum; {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 := ' ';
altseq[1] := CHR(0); {Data = ASCII, Sequence is altered}
altseq[2] := CHR(93); {94 characters in altered ASCII sequence}
{Put sequence in Altseq.Sequence contains all displayable ASCII characters}
strmove (15, ’!"#$%&’’)(*+,-./’, 1, altseq, 3);
strmove (16, '0123456789::<=>?’, 1, altseq, 18);
strmove (16, '@AaBbCcDdEeFfGgH', 1, altseq, 34);
strmove (16, 'hIiJjKkLlMmNnOoP', 1, altseq, 50);
strmove (16, 'pQqRrSsTtUuVvWwX', 1, altseq, 66);
strmove (15, 'xYyZz[\][caret ]_{|}˜', 1, altseq, 81);