The exit entry point registration call (MQXEP)

Use the MQXEP call to:

  1. Register the before and after WebSphere MQ API exit invocation points at which to invoke exit functions
  2. Specify the exit function entry points
  3. Deregister the exit function entry points

You would usually code the MQXEP calls in the MQ_INIT_EXIT exit function, but you can specify them in any subsequent exit function.

If you use an MQXEP call to register an already registered exit function, the second MQXEP call completes successfully, replacing the registered exit function.

If you use an MQXEP call to register a NULL exit function, the MQXEP call will complete successfully and the exit function is deregistered.

If MQXEP calls are used to register, deregister, and reregister a given exit function during the life of a connection request, the previously registered exit function is reactivated. Any storage still allocated and associated with this exit function instance is available for use by the exit's functions. (This storage is usually released during the invocation of the termination exit function).

The interface to MQXEP is:

MQXEP (Hconfig, ExitReason, Function, EntryPoint, Reserved, &CompCode, &Reason)

where:

Hconfig (MQHCONFIG) - input
The configuration handle, representing the API exit that includes the set of functions being initialized. This value is generated by the queue manager immediately before invoking the MQ_INIT_EXIT function, and is passed in the MQAXP to each API exit function.
ExitReason (MQLONG) - input
The reason for which the entry point is being registered, from the following:
Function (MQLONG) - input
The function identifier, valid values for which are the MQXF_* constants (see External constants).
EntryPoint (PMQFUNC) - input
The address of the entry point for the exit function to be registered. The value NULL indicates either that the exit function has not been provided, or that a previous registration of the exit function is being deregistered.
Reserved (MQPTR)
Set this to NULL.
CompCode (MQLONG) - output
The completion code, valid values for which are:
MQCC_OK
Successful completion.
MQCC_FAILED
Call failed.
Reason (MQLONG) - output
The reason code that qualifies the completion code.

If the completion code is MQCC_OK:

MQRC_NONE
(0, X'000') No reason to report.

If the completion code is MQCC_FAILED:

MQRC_HCONFIG_ERROR
(2280, X'8E8') The supplied configuration handle is not valid. Use the configuration handle from the MQAXP.
MQRC_EXIT_REASON_ERROR
(2377, X'949') The supplied exit function invocation reason is either not valid or is not valid for the supplied exit function identifier.

Either use one of the valid exit function invocation reasons (MQXR_* value), or use a valid function identifier and exit reason combination. (See Table 9.)

MQRC_FUNCTION_ERROR
(2281, X'8E9') The supplied function identifier is not valid for API exit reason. The following table shows valid combinations of function identifiers and ExitReasons.
Table 9. Valid combinations of function identifiers and ExitReasons
Function ExitReason
MQXF_INIT
MQXF_TERM
MQXR_CONNECTION
MQXF_CONN
MQXF_CONNX
MQXF_DISC
MQXF_OPEN
MQXF_CLOSE
MQXF_PUT1
MQXF_PUT
MQXF_GET
MQXF_INQ
MQXF_SET
MQXF_BEGIN
MQXF_COMMIT
MQXF_BACK
MQXR_BEFORE
MQXR_AFTER
MQXF_DATA_CONV_ON_GET MQXR_BEFORE
MQRC_RESOURCE_PROBLEM
(2102, X'836') An attempt to register or deregister an exit function has failed because of a resource problem.
MQRC_UNEXPECTED_ERROR
(2195, X'893') An attempt to register or deregister an exit function has failed unexpectedly.
MQRC_RESERVED_VALUE_ERROR
(2378, X'94A') The reserved parameter was not null.

MQXEP C language invocation

MQXEP (Hconfig, ExitReason, Function, EntryPoint, &CompCode, &Reason);

Declaration for parameter list:

        MQHCONFIG       Hconfig;        /* Configuration handle */
        MQLONG          ExitReason;     /* Exit reason */
        MQLONG          Function;       /* Function identifier */
        PMQFUNC         EntryPoint;     /* Function entry point */
        MQLONG          CompCode;       /* Completion code */
        MQLONG          Reason;         /* Reason code qualifying completion
                                           code */

MQXEP C function prototype

void MQXEP (
MQHCONFIG    Hconfig,        /* Configuration handle */
MQLONG       ExitReason,     /* Exit reason */
MQLONG       Function,       /* Function identifier */
PMQFUNC      EntryPoint,     /* Function entry point */
PMQLONG      pCompCode,      /* Address of completion code */
PMQLONG      pReason);       /* Address of reason code qualifying completion
                                code */