FastSort Manual

Using FastSort System Procedures
FastSort Manual429834-003
5-19
SORTMERGESTART Procedure
Merging Records From Input Streams
An input stream is a source of sorted records for merging. You can specify up to 32
input streams in the call to SORTMERGESTART, with the num-merge-files and
in-file-name parameters. The in-file-name parameter must specify all blanks
as the name for each input stream.
The first call to SORTMERGESEND sends the first input record from stream 0. After
each call, SORTMERGESEND puts the number of the next input stream that
SORTPROG wants a record from in stream-id. Stream numbers are consecutive
integers.
When an input stream has no more records, you set the length parameter of
SORTMERGESEND to –1. When all input streams have no more records,
SORTMERGESEND sets stream-id to –1; then SORTPROG finishes merging the
records and produces the output file or returns the records through
SORTMERGERECEIVE.
Examples
In this example, INBUF contains one input record, and INLEN is the number of bytes in
the record:
send^status := SORTMERGESEND (sortblock,
inbuf,
inlen);
In the next example, INBUF^EXT is the extended memory location of an input record.
Commas reserve places for the record-loc, stream-id, spare1, and spare2
parameters:
send^status := SORTMERGESEND (sortblock,,
inlen,,,,
inbuf^ext);
SORTMERGESTART Procedure
Use SORTMERGESTART to start the SORTPROG process and pass parameters to
SORTPROG for a sort or merge run. This procedure begins every run when you use