SORTINIT [ MPE/iX Intrinsics Reference Manual ] MPE/iX 5.0 Documentation
MPE/iX Intrinsics Reference Manual
SORTINIT
NM and CM callable.
Initiates the SORT program.
Syntax
___________________________________________________________
| |
| I16A I16A I16V |
| SORTINIT(inputfiles,outputfiles,outputoption, |
| I16V I32V I16V I16A |
| reclength,numrecs,numkeys,keys, |
| I16A PROC PROC I16A |
| altseq,keycompare,errorproc,statistics, |
| I16 I16 I16 I16A |
| failure,errorparm,spaceallocation,charseq);|
___________________________________________________________
Parameters
inputfiles 16-bit signed integer array (optional)
Passes the file identification numbers of the input
files to be sorted. The last element of this array
should be set to zero. If the files are opened
with either the NOBUF or MR (multirecord) access
option (aoption), the SORT program performs the
buffering and blocking/deblocking. $NULL is not a
valid input file.
outputfiles 16-bit signed integer array (optional)
Passes the file identification number of the output
file. The second array element must be a zero,
indicating the end of the array. If the files are
opened with either the NOBUF or MR (multirecord)
access option (aoption), the SORT program performs
the buffering and blocking/deblocking.
outputoption 16-bit signed integer by value (optional)
Passes a value that determines the format of the
output records:
Value Meaning
0 Output record is the same as the input record
(default).
1 Output record is a 32-bit integer whose value is the
logical (relative) record number of the record.
2 Output record contains only the key fields,
concatenated together with the major keys on the left,
followed by the remaining keys.
3 Output record is the logical record number followed by
the key fields.
reclength 16-bit signed integer by value (optional)
Passes the maximum length of a record in
characters. If you do not specify reclength, the
record length is taken from the first file
specified in the inputfiles parameter. If this
parameter is not specified, the inputfiles
parameter must be specified.
numrecs 32-bit signed integer by value (optional)
Passes the upper bound to the number of records to
be sorted. If numrecs is not specified (or if all
input files are not on the disk), the value of
10,000 (32-bit integer) is used. Otherwise, the
value of this parameter is derived from the file
label (the end of file number of the input files).
numkeys 16-bit signed integer by value (optional)
Passes the number of keys used during the
comparison of records. This parameter can be >= 1.
If the numkeys parameter is specified, the keys
parameter must be specified and the keycompare
parameter cannot be specified. Together, numkeys
and keys describe the way records are sorted.
keys 16-bit integer array (optional)
Passes information about the keys used during
comparison of records. If you specify the keys
parameter, you must specify the numkeys parameter
and must not specify keycompare. Together, keys
and numkeys describe the way records are merged.
The first element gives the position of the first
character of the key within the record. The second
element gives the number of characters in the key.
Bits (0:8) of the third element give the ordering
sequence of the records (0 for ascending, 1 for
descending). Bits (8:8) of the third element
indicate the type of data according to the
following convention:
Value Meaning
0 8-bit unsigned integer
1 Twos complement (including 16-bit and 32-bit signed
integer)
2 Floating-point (including real and long)
3 Packed decimal
4 Display trailing sign
5 Packed decimal with even number of digits
6 Display leading sign
7 Display leading sign separate
8 Display trailing sign separate
9 Character (using the collating sequence of charseq)
11 Short floating-point decimal
12 Floating-point decimal
NOTE The integrity of the keys array must be maintained throughout the
SORT operation. Do not change it until after the SORTEND intrinsic
has been called.
altseq 16-bit signed integer array (optional)
Passes an alternate collating sequence. Bits (0:8)
of the first element are specified according to the
following table, where the sequence comprises the
columns and the data comprises the rows:
excess space above nonumber table-->
ASCII EBCDIC ALTSEQ
ASCII chr(255) chr(2) chr(0)
EBCDIC chr(1) chr(255) undefined
Bits (8:8) of the first element specify one less
than the total number of characters in the
collating sequence (in this instance, chr(255) or
%377).
The remaining array elements comprise the actual
collating sequence responsible for the particular
SORT operation.
keycompare procedure (reserved)
Do not specify this parameter, but maintain
parameter position.
errorproc procedure (reserved)
Do not specify this parameter, but maintain
parameter position.
statistics 16-bit signed integer array (optional)
Returns information on the SORT operation, as
follows:
Value Meaning
1,2 Number of records sorted (32-bit integer)
3 Number of intermediate passes
4 Space available for sorting
5,6 Number of comparisons (32-bit integer)
7,8 Number of scratch file I/Os (32-bit integer)
9,10 CPU time used in milliseconds (32-bit integer)
11,12 Elapsed time in milliseconds (32-bit integer)
failure 16-bit signed integer (optional)
Returns a true value (-1) if a fatal error occurs;
otherwise returns a false value (0). The value is
set after each call to SORTINPUT and SORTOUTPUT.
Refer to the discussion of condition codes.
errorparm 16-bit signed integer (optional)
Returns the SORTLIB error number if an error
occurs. Use the SORTERRORMESS intrinsic to obtain
the error message text.
spaceallocation 16-bit signed integer (reserved)
Do not specify this parameter, but maintain
parameter position.
charseq 16-bit signed integer array (optional)
Passes language information in a two-element array.
Set the first element to 1. Set the second element
to the language ID number of the native language
whose collating sequence is to be used to sort keys
of type 9 (character).
Condition Codes
CCE (2) Request granted. No error occurred during the SORT
program. The value of the failure parameter of the
SORTINIT intrinsic is set to false.
CCG (0) Not returned.
CCL (1) Request denied. An error occurred during the SORT
program. The value of the failure parameter of the
SORTINIT intrinsic is set to true.
Related Information
Intrinsics HPSORT, HPMERGE
Commands None
Manuals SORT-MERGE/XL Programmer's Guide (32650-90080)
MPE/iX 5.0 Documentation