HPlogo MPE/iX Intrinsics Reference Manual > Chapter 9 Command Definitions (MAIL-PUTJCW)

MERGEINIT

MPE documents

Complete PDF
Table of Contents
Index

Edition 7 E0701
Edition 7 E0300 ♥
Edition 6 E0195

NM and CM callable.

Initializes the MERGE/XL subsystem and the merging of two or more sorted files.

Syntax



             I16A        PROC          I16A         PROC
  MERGEINIT (inputfiles, preprocessor, outputfiles, postprocessor,
  
    I16V      I16V     I16A  I16A    PROC        PROC 
    keysonly, numkeys, keys, altseq, keycompare, errorproc,
    
    I16A        I16      I16        I16              I16A
    statistics, failure, errorparm, spaceallocation, charseq);

Parameters


inputfiles

16-bit signed integer array (optional)

Passes the file identification numbers of the input files to be merged. 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 MERGE program performs the buffering and blocking/deblocking. $NULL is not a valid input file.

preprocessor

procedure (optional)

Do not specify, maintain parameter position.

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 (multi-record) access option (aoption), the MERGE program performs the buffering and blocking/deblocking.

postprocessor

procedure (optional)

Do not specify, maintain parameter position.

length

16-bit signed integer

Denotes the number of characters in the record.

keysonly

16-bit signed integer by value (optional)

Passes a flag that determines if only keys are sent as output. If true, the key fields are concatenated together with the major key on the left and the remaining keys following. If false, the entire record is sent as output.

Default: false.

numkeys

16-bit signed integer (optional)

Passes the 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 merged.

keys

16-bit signed 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. 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 MERGE operation. Do not change it until after you have called the MERGEEND intrinsic.

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:

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

Bits (8:8) of the first element specify one fewer 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 MERGE 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 MERGE operation, as follows:

Value

Meaning

1

Number of input files

2,3

Number of merged records (32-bit integer)

4

Space available for merging

5,6

Number of comparisons (32-bit integer)

7,8

CPU time in milliseconds (32-bit integer)

9,10

Elapsed time in milliseconds (32-bit integer)

failure

16-bit signed integer (optional)

Returns a true value (-1) if a fatal error occurs; otherwise failure returns a false value (0). Refer also to the discussion of condition codes.

errorparm

16-bit signed integer (optional)

Returns the error number if an error occurs. Use the MERGEERRORMESS 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 MERGE program. The value of the failure parameter of the MERGEINIT intrinsic is set to false.

CCG (0)

Not returned.

CCL (1)

Request denied. An error occurred during the MERGE program. The value of the failure parameter of the MERGEINIT intrinsic is set to true.

Related Information


Intrinsics

HPSORT, HPMERGE

Manual

SORT-MERGE/XL Programmer's Guide




MERGEERRORMESS


MERGEOUTPUT