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

18 Chapter2
Creating Core Routines That Sort and Merge
Structure of the Core Routines
Structure of the Core Routines
A simple sorting or merging operation can be performed using only three intrinsics and a
subset of their parameters.
HPSORTINIT begins the sorting process and HPMERGEINIT begins the merging process.
Parameters define what will be passed to the utility. All HPSORTINIT and
HPMERGEINIT parameters are optional.
This core routine uses parameters to define the input and output files, output format,
record length, keys, and a variable to return error information.
HPSORTEND and HPMERGEEND close the workspace, ending their processes.
HPSORTERRORMESS returns the error message associated with the error number
returned in the status parameter of HPSORTINIT. HPMERGEERRORMESS returns the
error message associated with the error number returned in the status parameter of
HPMERGEINIT
Intrinsic parameters are positional. If a parameter is not specified in an intrinsic call, its
position must be maintained by a comma.
NOTE
You must initialize and end a sort or a merge within the same procedure.
That is, HPSORTEND must be called from the same procedure that called
HPSORTINIT, and HPMERGEEND must be called from the same procedure that
called HPMERGEINIT.
You may run only one sorting or merging operation at a time. You can not
nest them.
Figure 2-1. shows the structure of the core sorting or merging routine.
Figure 2-1. Core Routine