SORT-MERGE/XL Programmer's Guide (32650-90884)
32 Chapter2
Creating Core Routines That Sort and Merge
Error Checking
Error Checking
The
status
parameter of HPSORTINIT and HPMERGEINIT is a 32-bit integer variable that
returns the status of each sort or merge intrinsic call. If no errors or warnings are
encountered,
status
returns 32 bits of zero. If errors are encountered,
status
is
interpreted as two 16-bit fields. Bits (0:16), the leftmost halfword, is
status.info
. A
negative value here indicates an error condition. Bits (16:16) are
status.subsys
. A
number here is coded to indicate the subsystem where the error occurred. A value of 195
indicates SORT/XL. A value of 196 identifies MERGE/XL. Although
status
is an optional
parameter, it is good programming practice to specify it. If it is not specified and an error
occurs, the calling process will abort.
You use HPSORTERRORMESS and HPMERGEERRORMESS to display a descriptive message to the
user if errors occur during a sort or merge. The HPSORTERRORMESS and HPMERGEERRORMESS
status
parameter accepts the error number returned from the HPSORTINIT and
HPMERGEINIT
status
parameter. Other error message parameters return the text message
associated with that error number, and the length of the message.
The syntax of HPSORTERRORMESS and HPMERGEERRORMESS is:
HPSORTERRORMESS (
status, message, length
);
HPMERGEERRORMESS (
status, message, length
);
The HPSORTERRORMESS and HPMERGEERRORMESS expect to interpret errors, not successes.
The merge and sort
status
parameters return zero if no errors occurred. If you do not
check this value before calling HPSORTERRORMESS or HPMERGEERRORMESS as the example
below does, the result could be confusing. Passing zero to the error message intrinsics
status
parameter, causes the
message
parameter to return the message: "HPERRORMSG
failed inside HPSORTERRORMESS" or "HPERRORMSG failed inside
HPMERGEERRORMESS".
If the HPSORTERRORMESS or HPMERGEERRORMESS intrinsic call fails,
status
returns the error
number associated with that failure.
The error numbers and messages for sort and merge intrinsics are listed in Appendixes A
and B.
For more information about calculating
status.info
and
status.subsys
, refer to the
MPE XL Intrinsics Reference Manual.