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

Chapter 2 19
Creating Core Routines That Sort and Merge
Initializing a Sort or Merge
Initializing a Sort or Merge
You must specify the following to initialize the SORT-MERGE/XL utility and start the
sorting or merging process:
input file(s)
output file
keys
data type and collating sequence
The HPSORTINIT intrinsic passes the information necessary to initialize the sorting
process, and HPMERGEINIT passes the information to initialize the merging process.
The syntax for HPSORTINIT and HPMERGEINIT is:
HPSORTINIT (
status, inputfiles, outputfile, outputoption,
reclength, numrecs, numkeys, keys, altseq, keycompare,
errorproc, statistics, memsize, charseq
);
HPMERGEINIT (
status, inputfiles, preprocessor, outputfile,
postprocessor, keysonly, numkeys, keys, altseq,
keycompare, errorproc, statistics, memsize, charseq
);
The core routine examples that follow do not use all of the parameters listed above. When
you enter these intrinsics, you must maintain the position of any unused parameters with
commas.
The
inputfiles
and
outputfiles
parameters in this chapter are files; input and output
by record is discussed in Chapter 3. The
altseq
and
charseq
parameters, which alter the
collating sequence, are discussed in Chapter 4. The
statistics
parameters, which get
SORT-MERGE/XL information, are discussed in Chapter 5
Specifying Input
The most common way to supply information to SORT-MERGE/XL is through an input file.
Input considerations include:
Creating input files.
Accessing input files.
Dealing with tape input.
Creating Input Files
SORT-MERGE/XL accepts one or more input files. You create these files with an editor, in
a program, or from a database. You may not use $NULL as an input file.
Remember that your data items must be in a fixed format. Each data item of the same type
must start in the same column. If your data is not in a fixed format, your results will be
unpredictable.