FastSort Manual

FastSort Manual429834-003
4-1
4 Sorting Programmatically
The FastSort programmatic interface consists of the FastSort system procedures. You
can use the FastSort system procedures to sort and merge records from an application
program. You can call FastSort system procedures from an application written in any
language that can call TAL procedures.
An application calls FastSort system procedures to start, control, and end a
SORTPROG process. The application sets up the sort or merge run in procedure calls
and supplies the input records directly or from one or more files. The SORTPROG
process performs all sorting and merging operations and either writes the output
records to a file or returns them to the application.
This section explains how to use a SORTPROG process from an application program.
It also provides COBOL85 and TAL examples of serial sorting. For general information
about sorting such as sorting on key fields, controlling extended memory size,
understanding statistics, and understanding error messages, see Section 2, Sorting
Interactively.
Using FastSort System Procedures
Table 4-1 lists FastSort procedures in the order in which your application might call
them. For a sort or merge run, you must call SORTMERGESTART and either
SORTMERGESTATISTICS or SORTMERGEFINISH. Other procedures communicate
information to the SORTPROG process and return error information. For information
about each procedure, including syntax, see Section 5, Using FastSort System
Procedures.
Table 4-1. FastSort System Procedures (page 1 of 2)
Procedure Name Description
SORTBUILDPARM Specifies parameters for parallel sorting, record blocking, and
overflow scratch volumes.
SORTMERGESTART Begins the SORTPROG process and passes sort or merge
parameters from the calling process to SORTPROG.
SORTMERGESEND Sends input records from the calling process to the
SORTPROG process, one for each call.
SORTMERGERECEIVE Returns output records from the SORTPROG process to the
calling process, one for each call.
SORTERROR Provides the message text for the last FastSort error code
returned by a procedure.
SORTERRORDETAIL Provides the FastSort error code for the most recent error
and if an input file caused the error, identifies the input file.