HPlogo 900 Series HP 3000 Computer Systems: MPE/iX Intrinsics Reference Manual > Chapter 4 Command Definitions

HPSORTINIT

» 

Technical documentation

Complete book in PDF
» Feedback

 » Table of Contents

 » Index

NM callable only.

Initializes the SORT/XL subsystem.

Syntax

               I32   I32A     I32A      I32

   HPSORTINIT(status,inputfiles,outputfiles,outputoption,

                I32V    I32V   I32V  I32A

              reclength,numrecs,numkeys,keys

                CA    PROC     PROC     I32A

              altseq,keycompare,errorproc,statistics,

                I32V   I32A

              memsize,charseq);

Parameters

status

32-bit signed integer by reference (optional)

Returns the status of the HPSORTINIT call. If no errors or warnings are encountered, status returns 32 bits of zero. If errors or warnings are encountered, status is interpreted as two 16-bit fields.

Bits (0:16) comprise status.info. A negative value indicates an error condition, and a positive value indicates a warning condition. Refer to the MPE/iX Error Message Manual Volumes 1, 2 and 3 (32650-90066, 32650-90152, and 32650-90368) for a description of its value.

Bits (16:16) comprise status.subsys. The value represented by these bits defines the subsystem that set the status information. The subsystem identifier for HPSORTINIT is 195.

inputfiles

32-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 Hewlett-Packard SORT program performs the buffering and blocking\deblocking. $NULL is not a valid input file.

If this parameter is not used, there must be a call to HPSORTINPUT to supply records to the Hewlett-Packard SORT program.

outputfiles

32-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/XL program performs the buffering and blocking\deblocking.

If you do not supply this parameter, you must call HPSORTOUTPUT to retrieve the sorted records.

outputoption

32-bit signed integer by value (optional)

Passes a value determining the format of the output records:

ValueMeaning
0Output record the same as input record (default)
1Output record, a 32-bit integer output in binary format, value is the logical (relative) record number of the record
2Output record contains only the key fields, concatenated together with the major keys on the left, followed by the remaining keys
3Output record is the logical record number (in binary format) followed by the key fields

reclength

32-bit signed integer by value (optional)

Maximum length of a record in bytes. If you do not specify reclength, the record length is taken from the first file specified in the inputfiles parameter. If you do not specify inputfiles, you must specify this parameter.

numrecs

32-bit signed integer by value (optional)

Upper bound to the number of records to be sorted. Use numrecs only if all input records do not reside on disk. numrecs may be used to determine the size of the temporary scratch files that SORT builds. The size of the scratch file(s) that SORT uses is calculated in the following way:

If all records are on disk, the size of the scratch file number is derived from the current EOF value of the input file and any value supplied for this parameter is ignored. (If there are multiple input files, then the sum of their EOFs is used).

If all files to be sorted do not reside on disk, or if you do not specify any input files at all, and you supply this parameter, numrecs will determine the size of the scratch file(s). Otherwise if you do not supply this parameter, a default value of 10,000 records per tape file is used.

numkeys

32-bit signed integer by value (optional)

Number of keys used during the comparison of records. This parameter can be either equal to or greater than one. If you specify the numkeys parameter, you must also specify the keys parameter. Together, numkeys and keys describe the way records are sorted.

keys

32-bit integer array (optional)

Passes information about the keys used during the comparison of records. If you specify the keys parameter, you must specify the numkeys parameter. Together, keys and numkeys describe the way records are sorted.

For each key, there are four entries in the array. The first element gives the position of the first byte of the key within the input record. The second element gives the number of bytes in the key. The third element indicates the type of data:

ValueMeaning
0Byte type (ASCII or EBCDIC)
1Twos complement (including 16-bit and 32-bit signed integer)
2Hewlett-Packard 3000 floating-point format (including real and long)
3IEEE standard floating-point format; (32-bit, 64-bit, and 128-bit values)
4Packed decimal with odd number of digits
5Packed decimal with even number of digits
6Display trailing sign
7Display leading sign
8Display trailing sign separate
9Display leading sign separate
10Character
11Reserved for the operating system
12Short floating-point decimal
13Floating-point decimal

The fourth element gives the ordering sequence of the records:

ValueMeaning
0Ascending
1Descending

NOTE: The integrity of the keys array must be maintained throughout the SORT/XL operation. Do not change it until after you have called the HPSORTEND intrinsic.
altseq

character array (optional)

Passes an alternate collating sequence. The first element is specified according to the following table, where the sequence comprises the columns and the data comprises the rows:

 ASCIIEBCDICALTSEQ
ASCIIchr(255)chr(2)chr(0)
EBCDICchr(1)chr(255)undefined

The second element specifies one fewer than the total number of characters in the collating sequence.

If the first element is CHR(0), the remaining array elements comprise the actual collating sequence responsible for the particular Hewlett-Packard SORT operation.

Default: element 1 = CHR(255), element 2 = CHR(255)

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

32-bit signed integer array (optional)

Returns information on the SORT/XL operation:

ValueMeaning
1Number of records sorted
2Number of intermediate passes
3Number of bytes in the SORT/XL program work area
4Number of compares
5CPU time used in milliseconds
6Elapsed time in milliseconds

memsize

32-bit signed integer by value (reserved)

Do not specify, but maintain parameter position.

charseq

32-bit signed integer array (optional)

Passes language information. Set the first element to 1 and the second element to the language ID of the native language collating sequence to be used for keys of type character (keys parameter equal to 10).

Related Information

Intrinsics

HPSORT, HPMERGE

Commands

None

Manuals

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

Feedback to webmaster