Invoking exit functions

This section tells you how to invoke the exit functions available. The descriptions of the individual functions start at The API exit functions. This section begins with some general information to help you when using these function calls.

General rules for API exit routines

The following general rules apply when invoking API exit routines:

The execution environment

In general, all errors from exit functions are communicated back to the exit handler using the ExitResponse and ExitResponse2 fields in MQAXP. These errors in turn are converted into MQCC_* and MQRC_* values and communicated back to the application in the CompCode and Reason fields. However, any errors encountered in the exit handler logic are communicated back to the application as MQCC_* and MQRC_* values in the CompCode and Reason fields.

If an MQ_TERM_EXIT function returns an error:

In other words, the exit cannot be unloaded as it might still be in use. Also, other registered exits further down in the exit chain for which the before exit was successful, will be driven in the reverse order.

Setting up the exit execution environment

While processing an explicit MQCONN or MQCONNX call, exit handling logic sets up the exit execution environment before invoking the exit initialization function (MQ_INIT_EXIT). Exit execution environment setup involves loading the exit, acquiring storage for, and initializing exit parameter structures. The exit configuration handle is also allocated at this point.

If errors occur during this phase, the MQCONN or MQCONNX call fails with CompCode MQCC_FAILED and one of the following reason codes:

MQRC_API_EXIT_LOAD_ERROR
An attempt to load an API exit module has failed.
MQRC_API_EXIT_NOT_FOUND
An API exit function could not be found in the API exit module.
MQRC_STORAGE_NOT_AVAILABLE
An attempt to initialize the execution environment for an API exit function failed because insufficient storage was available.
MQRC_API_EXIT_INIT_ERROR
An error was encountered while initializing the execution environment for an API exit function.
Cleaning up the exit execution environment

While processing an explicit MQDISC call, or an implicit disconnect request as a result of an application ending, exit handling logic might need to clean up the exit execution environment after invoking the exit termination function (MQ_TERM_EXIT), if registered. Cleaning up the exit execution environment involves releasing storage for exit parameter structures, possibly deleting any modules previously loaded into memory.

If errors occur during this phase, an explicit MQDISC call fails with CompCode MQCC_FAILED and the following reason code (errors are not highlighted on implicit disconnect requests):

MQRC_API_EXIT_TERM_ERROR
An error was encountered while closing the execution environment for an API exit function. The exit should not return any failure from the MQDISC before or after the MQ_TERM* API exit function calls.

The API exit functions

This section describes each of the exit functions and its parameters, as follows:

Backout - MQ_BACK_EXIT

MQ_BACK_EXIT provides a backout exit function to perform before and after backout processing. Use function identifier MQXF_BACK with exit reasons MQXR_BEFORE and MQXR_AFTER to register before and after backout call exit functions.

The interface to this functions:

MQ_BACK_EXIT (&ExitParms, &ExitContext, &Hconn, &CompCode, &Reason)

where the parameters are:

ExitParms (MQAXP) - input/output
Exit parameter structure.
ExitContext (MQAXC) - input/output
Exit context structure.
Hconn (MQHCONN) - input
Connection handle.
CompCode (MQLONG) - input/output
Completion code, valid values for which are:
MQCC_OK
Successful completion.
MQCC_WARNING
Partial completion.
MQCC_FAILED
Call failed
Reason (MQLONG) - input/output
Reason code qualifying the completion code.

If the completion code is MQCC_OK, the only valid value is:

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

If the completion code is MQCC_FAILED or MQCC_WARNING, the exit function can set the reason code field to any valid MQRC_* value.

C language invocation

The queue manager logically defines the following variables:

        MQAXP    ExitParms;      /* Exit parameter structure */
        MQAXC    ExitContext;    /* Exit context structure */
        MQHCONN  Hconn;          /* Connection handle */
        MQLONG   CompCode;       /* Completion code */
        MQLONG   Reason;         /* Reason code qualifying completion code */

The queue manager then logically calls the exit as follows:

MQ_BACK_EXIT (&ExitParms, &ExitContext, &Hconn, &CompCode, &Reason);

Your exit must match the following C function prototype:

void MQENTRY MQ_BACK_EXIT (
PMQAXP    pExitParms,       /* Address of exit parameter structure */
PMQAXC    pExitContext,     /* Address of exit context structure */
PMQHCONN  pHconn,           /* Address of connection handle */
PMQLONG   pCompCode,        /* Address of completion code */
PMQLONG   pReason);         /* Address of reason code qualifying completion
                               code */
Begin - MQ_BEGIN_EXIT

MQ_BEGIN_EXIT provides a begin exit function to perform before and after MQBEGIN call processing. Use function identifier MQXF_BEGIN with exit reasons MQXR_BEFORE and MQXR_AFTER to register before and after MQBEGIN call exit functions.

The interface to this function is:

MQ_BEGIN_EXIT (&ExitParms, &ExitContext, &Hconn, &pBeginOptions, &CompCode,
               &Reason)

where the parameters are:

ExitParms (MQAXP) - input/output
Exit parameter structure.
ExitContext (MQAXC) - input/output
Exit context structure.
Hconn (MQHCONN) - input
Connection handle.
pBeginOptions (PMQBO)- input/output
Pointer to begin options.
CompCode (MQLONG) - input/output
Completion code, valid values for which are:
MQCC_OK
Successful completion.
MQCC_WARNING
Partial completion.
MQCC_FAILED
Call failed
Reason (MQLONG) - input/output
Reason code qualifying the completion code.

If the completion code is MQCC_OK, the only valid value is:

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

If the completion code is MQCC_FAILED or MQCC_WARNING, the exit function can set the reason code field to any valid MQRC_* value.

C language invocation

The queue manager logically defines the following variables:

        MQAXP    ExitParms;      /* Exit parameter structure */
        MQAXC    ExitContext;    /* Exit context structure */
        MQHCONN  Hconn;          /* Connection handle */
        PMQBO    pBeginOptions;  /* Ptr to begin options */
        MQLONG   CompCode;       /* Completion code */
        MQLONG   Reason;         /* Reason code qualifying completion code */

The queue manager then logically calls the exit as follows:

MQ_BEGIN_EXIT (&ExitParms, &ExitContext, &Hconn, &pBeginOptions, &CompCode,
               &Reason);

Your exit must match the following C function prototype:

void MQENTRY MQ_BEGIN_EXIT (
PMQAXP    pExitParms,       /* Address of exit parameter structure */
PMQAXC    pExitContext,     /* Address of exit context structure */
PMQHCONN  pHconn,           /* Address of connection handle */
PPMQBO    ppBeginOptions,   /* Address of ptr to begin options */
PMQLONG   pCompCode,        /* Address of completion code */
PMQLONG   pReason);         /* Address of reason code qualifying completion
                               code */
Close - MQ_CLOSE_EXIT

MQ_CLOSE_EXIT provides a close exit function to perform before and after MQCLOSE call processing. Use function identifier MQXF_CLOSE with exit reasons MQXR_BEFORE and MQXR_AFTER to register before and after MQCLOSE call exit functions.

The interface to this function is:

MQ_CLOSE_EXIT (&ExitParms, &ExitContext, &Hconn, &pHobj,
               &Options, &CompCode, &Reason)

where the parameters are:

ExitParms (MQAXP) - input/output
Exit parameter structure.
ExitContext (MQAXC) - input/output
Exit context structure.
Hconn (MQHCONN) - input
Connection handle.
pHobj (PMQHOBJ) - input
Pointer to object handle.
Options (MQLONG)- input/output
Close options.
CompCode (MQLONG) - input/output
Completion code, valid values for which are:
MQCC_OK
Successful completion.
MQCC_FAILED
Call failed
Reason (MQLONG) - input/output
Reason code qualifying the completion code.

If the completion code is MQCC_OK, the only valid value is:

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

If the completion code is MQCC_FAILED, the exit function can set the reason code field to any valid MQRC_* value.

C language invocation

The queue manager logically defines the following variables:

        MQAXP           ExitParms;      /* Exit parameter structure */
        MQAXC           ExitContext;    /* Exit context structure */
        MQHCONN         Hconn;          /* Connection handle */
        PMQHOBJ         pHobj;          /* Ptr to object handle */
        MQLONG          Options;        /* Close options */
        MQLONG          CompCode;       /* Completion code */
        MQLONG          Reason;         /* Reason code */

The queue manager then logically calls the exit as follows:

MQ_CLOSE_EXIT (&ExitParms, &ExitContext,&Hconn, &pHobj, &Options,
               &CompCode, &Reason);

Your exit must match the following C function prototype:

void MQENTRY MQ_CLOSE_EXIT (
PMQAXP          pExitParms,     /* Address of exit parameter structure */
PMQAXC          pExitContext,   /* Address of exit context structure */
PMQHCONN        pHconn,         /* Address of connection handle */
PPMQHOBJ        ppHobj,         /* Address of ptr to object handle */
PMQLONG         pOptions,       /* Address of close options */
PMQLONG         pCompCode,      /* Address of completion code */
PMQLONG         pReason);       /* Address of reason code qualifying
                                   completion code */
Commit - MQ_CMIT_EXIT

MQ_CMIT_EXIT provides a commit exit function to perform before and after commit processing. Use function identifier MQXF_CMIT with exit reasons MQXR_BEFORE and MQXR_AFTER to register before and after commit call exit functions.

If a commit operation fails, and the transaction is backed out, the MQCMIT call fails with MQCC_WARNING and MQRC_BACKED_OUT. These return and reason codes are passed into any after MQCMIT exit functions to give the exit functions an indication that the unit of work has been backed out.

The interface to this function is:

MQ_CMIT_EXIT (&ExitParms, &ExitContext, &Hconn, &CompCode, &Reason)

where the parameters are:

ExitParms (MQAXP) - input/output
Exit parameter structure.
ExitContext (MQAXC) - input/output
Exit context structure.
Hconn (MQHCONN) - input
Connection handle.
CompCode (MQLONG) - input/output
Completion code, valid values for which are:
MQCC_OK
Successful completion.
MQCC_WARNING
Partial completion.
MQCC_FAILED
Call failed
Reason (MQLONG) - input/output
Reason code qualifying the completion code.

If the completion code is MQCC_OK, the only valid value is:

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

If the completion code is MQCC_FAILED or MQCC_WARNING, the exit function can set the reason code field to any valid MQRC_* value.

C language invocation

The queue manager logically defines the following variables:

        MQAXP    ExitParms;      /* Exit parameter structure */
        MQAXC    ExitContext;    /* Exit context structure */
        MQHCONN  Hconn;          /* Connection handle */
        MQLONG   CompCode;       /* Completion code */
        MQLONG   Reason;         /* Reason code qualifying completion code */

The queue manager then logically calls the exit as follows:

MQ_CMIT_EXIT (&ExitParms, &ExitContext,&Hconn, &CompCode, &Reason);

Your exit must match the following C function prototype:

void MQENTRY MQ_CMIT_EXIT (
PMQAXP    pExitParms,       /* Address of exit parameter structure */
PMQAXC    pExitContext,     /* Address of exit context structure */
PMQHCONN  pHconn,           /* Address of connection handle */
PMQLONG   pCompCode,        /* Address of completion code */
PMQLONG   pReason);         /* Address of reason code qualifying completion
                               code */
Connect and connect extension - MQ_CONNX_EXIT

MQ_CONNX_EXIT provides:

The same interface, as described below, is invoked for both MQCONN and MQCONNX call exit functions.

When the message channel agent (MCA) responds to an inbound client connection, the MCA can connect and make a number of WebSphere MQ API calls before the client state is fully known. These API calls call the API exit functions with the MQAXC based on the MCA program itself (for example in the UserId and ConnectionName fields of the MQAXC).

When the MCA responds to subsequent inbound client API calls, the MQAXC structure is based on the inbound client, setting the UserId and ConnectionName fields appropriately.

The queue manager name set by the application on an MQCONN or MQCONNX call is passed to the underlying connect call. Any attempt by a before MQ_CONNX_EXIT to change the name of the queue manager has no effect.

Use function identifiers MQXF_CONN and MQXF_CONNX with exit reasons MQXR_BEFORE and MQXR_AFTER to register before and after MQCONN and MQCONNX call exit functions.

An MQ_CONNX_EXIT exit called for reason MQXR_BEFORE must not issue any WebSphere MQ API calls, as the correct environment has not been set up at this time.

The interface to MQCONN and MQCONNX is identical:

MQ_CONNX_EXIT (&ExitParms, &ExitContext, &pQMgrName, &pConnectOpts,
               &pHconn, &CompCode, &Reason);

where the parameters are:

ExitParms (MQAXP) - input/output
Exit parameter structure.
ExitContext (MQAXC) - input/output
Exit context structure.
pQMgrName (PMQCHAR) - input
Pointer to the queue manager name supplied on the MQCONNX call. The exit must not change this name on the MQCONN or MQCONNX call.
pConnectOpts (PMQCNO) - input/output
Pointer to the options that control the action of the MQCONNX call.

See "MQCNO - Connect options" in the WebSphere MQ Application Programming Reference for details.

For exit function MQXF_CONN, pConnectOpts points to the default connect options structure (MQCNO_DEFAULT).

pHconn (PMQHCONN) - input
Pointer to the connection handle.
CompCode (MQLONG) - input/output
Completion code, valid values for which are:
MQCC_OK
Successful completion.
MQCC_WARNING
Warning (partial completion)
MQCC_FAILED
Call failed
Reason (MQLONG) - input/output
Reason code qualifying the completion code.

If the completion code is MQCC_OK, the only valid value is:

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

If the completion code is MQCC_FAILED or MQCC_WARNING, the exit function can set the reason code field to any valid MQRC_* value.

C language invocation

The queue manager logically defines the following variables:

        MQAXP           ExitParms;      /* Exit parameter structure */
        MQAXC           ExitContext;    /* Exit context structure */
        PMQCHAR         pQMgrName;      /* Ptr to Queue manager name */
        PMQCNO          pConnectOpts;   /* Ptr to Connection options */
        PMQHCONN        pHconn;         /* Ptr to Connection handle */
        MQLONG          CompCode;       /* Completion code */
        MQLONG          Reason;         /* Reason code */

The queue manager then logically calls the exit as follows:

MQ_CONNX_EXIT (&ExitParms, &ExitContext, &pQMgrName, &pConnectOps,
               &pHconn, &CompCode, &Reason);

Your exit must match the following C function prototype:

void MQENTRY MQ_CONNX_EXIT (
PMQAXP          pExitParms,     /* Address of exit parameter structure */
PMQAXC          pExitContext,   /* Address of exit context structure */
PPMQCHAR        ppQMgrName,     /* Address of ptr to queue manager name */
PPMQCNO         ppConnectOpts,  /* Address of ptr to connection options */
PPMQHCONN       ppHconn,        /* Address of ptr to connection handle */
PMQLONG         pCompCode,      /* Address of completion code */
PMQLONG         pReason);       /* Address of reason code qualifying
                                   completion code */
Disconnect - MQ_DISC_EXIT

MQ_DISC_EXIT provides a disconnect exit function to perform before and after MQDISC exit processing. Use function identifier MQXF_DISC with exit reasons MQXR_BEFORE and MQXR_AFTER to register before and after MQDISC call exit functions.

The interface to this function is

MQ_DISC_EXIT (&ExitParms, &ExitContext, &pHconn,
              &CompCode, &Reason);

where the parameters are:

ExitParms (MQAXP) - input/output
Exit parameter structure.
ExitContext (MQAXC) - input/output
Exit context structure.
pHconn (PMQHCONN) - input
Pointer to the connection handle.

For the before MQDISC call, the value of this field is one of:

For the after MQDISC call, the value of this field is zero or a value set by a previous exit function invocation.

CompCode (MQLONG) - input/output
Completion code, valid values for which are:
MQCC_OK
Successful completion.
MQCC_WARNING
Partial completion
MQCC_FAILED
Call failed
Reason (MQLONG) - input/output
Reason code qualifying the completion code.

If the completion code is MQCC_OK, the only valid value is:

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

If the completion code is MQCC_FAILED or MQCC_WARNING, the exit function can set the reason code field to any valid MQRC_* value.

C language invocation

The queue manager logically defines the following variables:

        MQAXP           ExitParms;      /* Exit parameter structure */
        MQAXC           ExitContext;    /* Exit context structure */
        PMQHCONN        pHconn;         /* Ptr to Connection handle */
        MQLONG          CompCode;       /* Completion code */
        MQLONG          Reason;         /* Reason code */

The queue manager then logically calls the exit as follows:

MQ_DISC_EXIT (&ExitParms, &ExitContext, &pHconn,
              &CompCode, &Reason);

Your exit must match the following C function prototype:

void MQENTRY MQ_DISC_EXIT (
PMQAXP          pExitParms,     /* Address of exit parameter structure */
PMQAXC          pExitContext,   /* Address of exit context structure */
PPMQHCONN       ppHconn,        /* Address of ptr to connection handle */
PMQLONG         pCompCode,      /* Address of completion code */
PMQLONG         pReason);       /* Address of reason code qualifying
                                   completion code */
Get - MQ_GET_EXIT

MQ_GET_EXIT provides a get exit function to perform before and after MQGET call processing. There are two function identifiers:

  1. Use MQXF_GET with exit reasons MQXR_BEFORE and MQXR_AFTER to register before and after MQGET call exit functions.
  2. Use MQXF_DATA_CONV_ON_GET with exit reason MQXR_BEFORE to register a before MQGET data conversion exit function.

The interface to this function is:

MQ_GET_EXIT (&ExitParms, &ExitContext, &Hconn, &Hobj, &pMsgDesc,
             &pGetMsgOpts, &BufferLength, &pBuffer, &pDataLength,
             &CompCode, &Reason)

where the parameters are:

ExitParms (MQAXP) - input/output
Exit parameter structure.
ExitContext (MQAXC) - input/output
Exit context structure.
Hconn (MQHCONN) - input
Connection handle.
Hobj (MQHOBJ) - input/output
Object handle.
pMsgDesc (PMQMD) - input/output
Pointer to message descriptor.
pGetMsgOpts (PMQPMO) - input/output
Pointer to get message options.
BufferLength (MQLONG) - input/output
Message buffer length.
pBuffer (PMQBYTE) - input/output
Pointer to message buffer.
pDataLength (PMQLONG) - input/output
Pointer to data length field.
CompCode (MQLONG) - input/output
Completion code, valid values for which are:
MQCC_OK
Successful completion.
MQCC_WARNING
Partial completion.
MQCC_FAILED
Call failed
Reason (MQLONG) - input/output
Reason code qualifying the completion code.

If the completion code is MQCC_OK, the only valid value is:

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

If the completion code is MQCC_FAILED or MQCC_WARNING, the exit function can set the reason code field to any valid MQRC_* value.

C language invocation

The queue manager logically defines the following variables:

        MQAXP           ExitParms;      /* Exit parameter structure */
        MQAXC           ExitContext;    /* Exit context structure */
        MQHCONN         Hconn;          /* Connection handle */
        MQHOBJ          Hobj;           /* Object handle */
        PMQMD           pMsgDesc;       /* Ptr to message descriptor */
        PMQPMO          pGetMsgOpts;    /* Ptr to get message options */
        MQLONG          BufferLength;   /* Message buffer length */
        PMQBYTE         pBuffer;        /* Ptr to message buffer */
        PMQLONG         pDataLength;    /* Ptr to data length field */
        MQLONG          CompCode;       /* Completion code */
        MQLONG          Reason;         /* Reason code */

The queue manager then logically calls the exit as follows:

MQ_GET_EXIT (&ExitParms, &ExitContext, &Hconn, &Hobj, &pMsgDesc,
             &pGetMsgOpts, &BufferLength, &pBuffer, &pDataLength,
             &CompCode, &Reason)

Your exit must match the following C function prototype:

void MQENTRY MQ_GET_EXIT (
PMQAXP          pExitParms,     /* Address of exit parameter structure */
PMQAXC          pExitContext,   /* Address of exit context structure */
PMQHCONN        pHconn,         /* Address of connection handle */
PMQHOBJ         pHobj,          /* Address of object handle */
PPMQMD          ppMsgDesc,      /* Address of ptr to message descriptor */
PPMQGMO         ppGetMsgOpts,   /* Address of ptr to get message options */
PMQLONG         pBufferLength,  /* Address of message buffer length */
PPMQBYTE        ppBuffer,       /* Address of ptr to message buffer */
PPMQLONG        ppDataLength,   /* Address of ptr to data length field */
PMQLONG         pCompCode,      /* Address of completion code */
PMQLONG         pReason);       /* Address of reason code qualifying
                                   completion code */
Initialization - MQ_INIT_EXIT

MQ_INIT_EXIT provides connection level initialization, indicated by setting ExitReason in MQAXP to MQXR_CONNECTION. During the initialization, note the following:

The interface to MQ_INIT_EXIT is:

MQ_INIT_EXIT (&ExitParms, &ExitContext, &CompCode, &Reason)

where the parameters are:

ExitParms (MQAXP) - input/output
Exit parameter structure.
ExitContext (MQAXC) - input/output
Exit context structure.
CompCode (MQLONG) - input/output
Pointer to completion code, valid values for which are:
MQCC_OK
Successful completion.
MQCC_WARNING
Partial completion.
MQCC_FAILED
Call failed
Reason (MQLONG) - input/output
Pointer to reason code qualifying the completion code.

If the completion code is MQCC_OK, the only valid value is:

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

If the completion code is MQCC_FAILED or MQCC_WARNING, the exit function can set the reason code field to any valid MQRC_* value.

The CompCode and Reason returned to the application depend on the value of the ExitResponse field in MQAXP.

C language invocation

The queue manager logically defines the following variables:

        MQAXP           ExitParms;      /* Exit parameter structure */
        MQAXC           ExitContext;    /* Exit context structure */
        MQLONG          CompCode;       /* Completion code */
        MQLONG          Reason;         /* Reason code */

The queue manager then logically calls the exit as follows:

MQ_INIT_EXIT (&ExitParms, &ExitContext, &CompCode, &Reason)

Your exit must match the following C function prototype:

void MQENTRY MQ_INIT_EXIT (
PMQAXP          pExitParms,     /* Address of exit parameter structure */
PMQAXC          pExitContext,   /* Address of exit context structure */
PMQLONG         pCompCode,      /* Address of completion code */
PMQLONG         pReason);       /* Address of reason code qualifying
                                   completion code */
Inquire - MQ_INQ_EXIT

MQ_INQ_EXIT provides an inquire exit function to perform before and after MQINQ call processing. Use function identifier MQXF_INQ with exit reasons MQXR_BEFORE and MQXR_AFTER to register before and after MQINQ call exit functions.

The interface to this function is:

MQ_INQ_EXIT (&ExitParms, &ExitContext, &Hconn, &Hobj, &SelectorCount,
             &pSelectors, &IntAttrCount, &pIntAttrs, &CharAttrLength,
             &pCharAttrs, &CompCode, &Reason)

where the parameters are:

ExitParms (MQAXP) - input/output
Exit parameter structure.
ExitContext (MQAXC) - input/output
Exit context structure.
Hconn (MQHCONN) - input
Connection handle.
Hobj (MQHOBJ) - input
Object handle.
SelectorCount (MQLONG) - input
Count of selectors
pSelectors (PMQLONG) - input/output
Pointer to array of selector values.
IntAttrCount (MQLONG) - input
Count of integer attributes.
pIntAttrs (PMQLONG) - input/output
Pointer to array of integer attribute values.
CharAttrLength (MQLONG) - input/output
Character attributes array length.
pCharAttrs (PMQCHAR) - input/output
Pointer to character attributes array.
CompCode (MQLONG) - input/output
Completion code, valid values for which are:
MQCC_OK
Successful completion.
MQCC_WARNING
Partial completion.
MQCC_FAILED
Call failed
Reason (MQLONG) - input/output
Reason code qualifying the completion code.

If the completion code is MQCC_OK, the only valid value is:

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

If the completion code is MQCC_FAILED or MQCC_WARNING, the exit function can set the reason code field to any valid MQRC_* value.

C language invocation

The queue manager logically defines the following variables:

        MQAXP    ExitParms;       /* Exit parameter structure */
        MQAXC    ExitContext;     /* Exit context structure */
        MQHCONN  Hconn;           /* Connection handle */
        MQHOBJ   Hobj;            /* Object handle */
        MQLONG   SelectorCount;   /* Count of selectors */
        PMQLONG  pSelectors;      /* Ptr to array of attribute selectors */
        MQLONG   IntAttrCount;    /* Count of integer attributes */
        PMQLONG  pIntAttrs;       /* Ptr to array of integer attributes */
        MQLONG   CharAttrLength;  /* Length of char attributes array */
        PMQCHAR  pCharAttrs;      /* Ptr to character attributes */
        MQLONG   CompCode;        /* Completion code */
        MQLONG   Reason;          /* Reason code qualifying completion code */

The queue manager then logically calls the exit as follows:

MQ_INQ_EXIT (&ExitParms, &ExitContext, &Hconn, &Hobj, &SelectorCount,
             &pSelectors, &IntAttrCount, &pIntAttrs, &CharAttrLength,
             &pCharAttrs, &CompCode, &Reason)

Your exit must match the following C function prototype:

void MQENTRY MQ_INQ_EXIT (
PMQAXP    pExitParms,       /* Address of exit parameter structure */
PMQAXC    pExitContext,     /* Address of exit context structure */
PMQHCONN  pHconn,           /* Address of connection handle */
PMQHOBJ   pHobj,            /* Address of object handle */
PMQLONG   pSelectorCount,   /* Address of selector count */
PPMQLONG  ppSelectors,      /* Address of ptr to array of selectors */
PMQLONG   pIntAttrCount;    /* Address of count of integer attributes */
PPMQLONG  ppIntAttrs,       /* Address of ptr to array of integer attributes */
PMQLONG   pCharAttrLength,  /* Address of character attribute length */
PPMQCHAR  ppCharAttrs,      /* Address of ptr to character attributes array */
PMQLONG   pCompCode,        /* Address of completion code */
PMQLONG   pReason);         /* Address of reason code qualifying completion
                               code */
Open - MQ_OPEN_EXIT

MQ_OPEN_EXIT provides an open exit function to perform before and after MQOPEN call processing. Use function identifier MQXF_OPEN with exit reasons MQXR_BEFORE and MQXR_AFTER to register before and after MQOPEN call exit functions.

The interface to this function is

MQ_OPEN_EXIT (&ExitParms, &ExitContext, &Hconn, &pObjDesc, &Options,
              &pHobj, &CompCode, &Reason)

where the parameters are:

ExitParms (MQAXP) - input/output
Exit parameter structure.
ExitContext (MQAXC) - input/output
Exit context structure.
Hconn (MQHCONN) - input
Connection handle.
pObjDesc (PMQOD) - input/output
Pointer to object descriptor.
Options (MQLONG) - input/output
Open options.
pHobj (PMQHOBJ) - input
Pointer to object handle.
CompCode (MQLONG) - input/output
Completion code, valid values for which are:
MQCC_OK
Successful completion.
MQCC_WARNING
Partial completion
MQCC_FAILED
Call failed
Reason (MQLONG) - input/output
Reason code qualifying the completion code.

If the completion code is MQCC_OK, the only valid value is:

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

If the completion code is MQCC_FAILED or MQCC_WARNING, the exit function can set the reason code field to any valid MQRC_* value.

C language invocation

The queue manager logically defines the following variables:

        MQAXP           ExitParms;      /* Exit parameter structure */
        MQAXC           ExitContext;    /* Exit context structure */
        MQHCONN         Hconn;          /* Connection handle */
        PMQOD           pObjDesc;       /* Ptr to object descriptor */
        MQLONG          Options;        /* Open options */
        PMQHOBJ         pHobj;          /* Ptr to object handle */
        MQLONG          CompCode;       /* Completion code */
        MQLONG          Reason;         /* Reason code */

The queue manager then logically calls the exit as follows:

MQ_OPEN_EXIT (&ExitParms, &ExitContext, &Hconn, &pObjDesc, &Options,
              &pHobj, &CompCode, &Reason);

Your exit must match the following C function prototype:

void MQENTRY MQ_OPEN_EXIT (
PMQAXP          pExitParms,     /* Address of exit parameter structure */
PMQAXC          pExitContext,   /* Address of exit context structure */
PMQHCONN        pHconn,         /* Address of connection handle */
PPMQOD          ppObjDesc,      /* Address of ptr to object descriptor */
PMQLONG         pOptions,       /* Address of open options */
PPMQHOBJ        ppHobj,         /* Address of ptr to object handle */
PMQLONG         pCompCode,      /* Address of completion code */
PMQLONG         pReason);       /* Address of reason code qualifying
                                   completion code */
Put - MQ_PUT_EXIT

MQ_PUT_EXIT provides a put exit function to perform before and after MQPUT call processing. Use function identifier MQXF_PUT with exit reasons MQXR_BEFORE and MQXR_AFTER to register before and after MQPUT call exit functions.

The interface to this function is:

MQ_PUT_EXIT (&ExitParms, &ExitContext, &Hconn, &Hobj, &pMsgDesc,
             &pPutMsgOpts, &BufferLength, &pBuffer, &CompCode, &Reason)

where the parameters are:

ExitParms (MQAXP) - input/output
Exit parameter structure.
ExitContext (MQAXC) - input/output
Exit context structure.
Hconn (MQHCONN) - input
Connection handle.
Hobj (MQHOBJ) - input/output
Object handle.
pMsgDesc (PMQMD) - input/output
Pointer to message descriptor.
pPutMsgOpts (PMQPMO) - input/output
Pointer to put message options.
BufferLength (MQLONG) - input/output
Message buffer length.
pBuffer (PMQBYTE) - input/output
Pointer to message buffer.
CompCode (MQLONG) - input/output
Completion code, valid values for which are:
MQCC_OK
Successful completion.
MQCC_WARNING
Partial completion.
MQCC_FAILED
Call failed
Reason (MQLONG) - input/output
Reason code qualifying the completion code.

If the completion code is MQCC_OK, the only valid value is:

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

If the completion code is MQCC_FAILED or MQCC_WARNING, the exit function can set the reason code field to any valid MQRC_* value.

C language invocation

The queue manager logically defines the following variables:

        MQAXP           ExitParms;      /* Exit parameter structure */
        MQAXC           ExitContext;    /* Exit context structure */
        MQHCONN         Hconn;          /* Connection handle */
        MQHOBJ          Hobj;           /* Object handle */
        PMQMD           pMsgDesc;       /* Ptr to message descriptor */
        PMQPMO          pPutMsgOpts;    /* Ptr to put message options */
        MQLONG          BufferLength;   /* Message buffer length */
        PMQBYTE         pBuffer;        /* Ptr to message data */
        MQLONG          CompCode;       /* Completion code */
        MQLONG          Reason;         /* Reason code */

The queue manager then logically calls the exit as follows:

MQ_PUT_EXIT (&ExitParms, &ExitContext, &Hconn, &Hobj, &pMsgDesc,
             &pPutMsgOpts, &BufferLength, &pBuffer, &CompCode, &Reason)

Your exit must match the following C function prototype:

void MQENTRY MQ_PUT_EXIT (
PMQAXP          pExitParms,     /* Address of exit parameter structure */
PMQAXC          pExitContext,   /* Address of exit context structure */
PMQHCONN        pHconn,         /* Address of connection handle */
PMQHOBJ         pHobj,          /* Address of object handle */
PPMQMD          ppMsgDesc,      /* Address of ptr to message descriptor */
PPMQPMO         ppPutMsgOpts,   /* Address of ptr to put message options */
PMQLONG         pBufferLength,  /* Address of message buffer length */
PPMQBYTE        ppBuffer,       /* Address of ptr to message buffer */
PMQLONG         pCompCode,      /* Address of completion code */
PMQLONG         pReason);       /* Address of reason code qualifying
                                   completion code */
Put1 - MQ_PUT1_EXIT

MQ_PUT1_EXIT provides a put one message only exit function to perform before and after MQPUT1 call processing. Use function identifier MQXF_PUT1 with exit reasons MQXR_BEFORE and MQXR_AFTER to register before and after MQPUT1 call exit functions.

The interface to this function is:

MQ_PUT1_EXIT (&ExitParms, &ExitContext, &Hconn, &pObjDesc, &pMsgDesc,
              &pPutMsgOpts, &BufferLength, &pBuffer, &CompCode, &Reason)

where the parameters are:

ExitParms (MQAXP) - input/output
Exit parameter structure.
ExitContext (MQAXC) - input/output
Exit context structure.
Hconn (MQHCONN) - input
Connection handle.
pObjDesc (PMQOD) - input/output
Pointer to object descriptor.
pMsgDesc (PMQMD) - input/output
Pointer to message descriptor.
pPutMsgOpts (PMQPMO) - input/output
Pointer to put message options.
BufferLength (MQLONG) - input/output
Message buffer length.
pBuffer (PMQBYTE) - input/output
Pointer to message buffer.
CompCode (MQLONG) - input/output
Completion code, valid values for which are:
MQCC_OK
Successful completion.
MQCC_WARNING
Partial completion.
MQCC_FAILED
Call failed
Reason (MQLONG) - input/output
Reason code qualifying the completion code.

If the completion code is MQCC_OK, the only valid value is:

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

If the completion code is MQCC_FAILED or MQCC_WARNING, the exit function can set the reason code field to any valid MQRC_* value.

C language invocation

The queue manager logically defines the following variables:

        MQAXP           ExitParms;      /* Exit parameter structure */
        MQAXC           ExitContext;    /* Exit context structure */
        MQHCONN         Hconn;          /* Connection handle */
        PMQOD           pObjDesc;       /* Ptr to object descriptor */
        PMQMD           pMsgDesc;       /* Ptr to message descriptor */
        PMQPMO          pPutMsgOpts;    /* Ptr to put message options */
        MQLONG          BufferLength;   /* Message buffer length */
        PMQBYTE         pBuffer;        /* Ptr to message data */
        MQLONG          CompCode;       /* Completion code */
        MQLONG          Reason;         /* Reason code */

The queue manager then logically calls the exit as follows:

MQ_PUT1_EXIT (&ExitParms, &ExitContext, &Hconn, &pObjDesc, &pMsgDesc,
              &pPutMsgOpts, &BufferLength, &pBuffer, &CompCode, &Reason)

Your exit must match the following C function prototype:

void MQENTRY MQ_PUT1_EXIT (
PMQAXP          pExitParms,     /* Address of exit parameter structure */
PMQAXC          pExitContext,   /* Address of exit context structure */
PMQHCONN        pHconn,         /* Address of connection handle */
PPMQOD          ppObjDesc,      /* Address of ptr to object descriptor */
PPMQMD          ppMsgDesc,      /* Address of ptr to message descriptor */
PPMQPMO         ppPutMsgOpts,   /* Address of ptr to put message options */
PMQLONG         pBufferLength,  /* Address of message buffer length */
PPMQBYTE        ppBuffer,       /* Address of ptr to message buffer */
PMQLONG         pCompCode,      /* Address of completion code */
PMQLONG         pReason);       /* Address of reason code qualifying
                                   completion code */
Set - MQ_SET_EXIT

MQ_SET_EXIT provides an inquire exit function to perform before and after MQSET call processing. Use function identifier MQXF_SET with exit reasons MQXR_BEFORE and MQXR_AFTER to register before and after MQSET call exit functions.

The interface to this function is:

MQ_SET_EXIT (&ExitParms, &ExitContext, &Hconn, &Hobj, &SelectorCount,
             &pSelectors, &IntAttrCount, &pIntAttrs, &CharAttrLength,
             &pCharAttr, &CompCode, &Reason)

where the parameters are:

ExitParms (MQAXP) - input/output
Exit parameter structure.
ExitContext (MQAXC) - input/output
Exit context structure.
Hconn (MQHCONN) - input
Connection handle.
Hobj (MQHOBJ) - input
Object handle.
SelectorCount (MQLONG) - input
Count of selectors
pSelectors (PMQLONG) - input/output
Pointer to array of selector values.
IntAttrCount (MQLONG) - input
Count of integer attributes.
pIntAttrs (PMQLONG) - input/output
Pointer to array of integer attribute values.
CharAttrLength (MQLONG) - input/output
Character attributes array length.
pCharAttrs (PMQCHAR) - input/output
Pointer to character attribute values.
CompCode (MQLONG) - input/output
Completion code, valid values for which are:
MQCC_OK
Successful completion.
MQCC_WARNING
Partial completion.
MQCC_FAILED
Call failed
Reason (MQLONG) - input/output
Reason code qualifying the completion code.

If the completion code is MQCC_OK, the only valid value is:

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

If the completion code is MQCC_FAILED or MQCC_WARNING, the exit function can set the reason code field to any valid MQRC_* value.

C language invocation

The queue manager logically defines the following variables:

        MQAXP    ExitParms;       /* Exit parameter structure */
        MQAXC    ExitContext;     /* Exit context structure */
        MQHCONN  Hconn;           /* Connection handle */
        MQHOBJ   Hobj;            /* Object handle */
        MQLONG   SelectorCount;   /* Count of selectors */
        PMQLONG  pSelectors;      /* Ptr to array of attribute selectors */
        MQLONG   IntAttrCount;    /* Count of integer attributes */
        PMQLONG  pIntAttrs;       /* Ptr to array of integer attributes */
        MQLONG   CharAttrLength;  /* Length of char attributes array */
        PMQCHAR  pCharAttrs;      /* Ptr to character attributes */
        MQLONG   CompCode;        /* Completion code */
        MQLONG   Reason;          /* Reason code qualifying completion code */

The queue manager then logically calls the exit as follows:

MQ_SET_EXIT (&ExitParms, &ExitContext, &Hconn, &Hobj, &SelectorCount,
             &pSelectors, &IntAttrCount, &pIntAttrs, &CharAttrLength,
             &pCharAttrs, &CompCode, &Reason)

Your exit must match the following C function prototype:

void MQENTRY MQ_SET_EXIT (
PMQAXP    pExitParms,       /* Address of exit parameter structure */
PMQAXC    pExitContext,     /* Address of exit context structure */
PMQHCONN  pHconn,           /* Address of connection handle */
PMQHOBJ   pHobj,            /* Address of object handle */
PMQLONG   pSelectorCount,   /* Address of selector count */
PPMQLONG  ppSelectors,      /* Address of ptr to array of selectors */
PMQLONG   pIntAttrCount;    /* Address of count of integer attributes */
PPMQLONG  ppIntAttrs,       /* Address of ptr to array of integer attributes */
PMQLONG   pCharAttrLength,  /* Address of character attribute length */
PPMQCHAR  ppCharAttrs,      /* Address of ptr to character attributes array */
PMQLONG   pCompCode,        /* Address of completion code */
PMQLONG   pReason);         /* Address of reason code qualifying completion
                               code */
Termination - MQ_TERM_EXIT

MQ_TERM_EXIT provides connection level termination, registered with a function identifier of MQXF_TERM and ExitReason MQXR_CONNECTION. If registered, MQ_TERM_EXIT is called once for every disconnect request.

As part of the termination, storage no longer required by the exit can be released, and any clean up required can be performed.

If an MQ_TERM_EXIT fails with MQXCC_FAILED, the queue manager returns from the MQDISC that called it with MQCC_FAILED and MQRC_API_EXIT_ERROR.

If the queue manager encounters an error while terminating the API exit function execution environment after invoking the last MQ_TERM_EXIT, the queue manager returns from the MQDISC call that invoked MQ_TERM_EXIT with MQCC_FAILED and MQRC_API_EXIT_TERM_ERROR

The interface to this function is:

MQ_TERM_EXIT (&ExitParms, &ExitContext, &CompCode, &Reason)

where the parameters are:

ExitParms (MQAXP) - input/output
Exit parameter structure.
ExitContext (MQAXC) - input/output
Exit context structure.
CompCode (MQLONG) - input/output
Completion code, valid values for which are:
MQCC_OK
Successful completion.
MQCC_FAILED
Call failed
Reason (MQLONG) - input/output
Reason code qualifying the completion code.

If the completion code is MQCC_OK, the only valid value is:

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

If the completion code is MQCC_FAILED, the exit function can set the reason code field to any valid MQRC_* value.

The CompCode and Reason returned to the application depend on the value of the ExitResponse field in MQAXP.

C language invocation

The queue manager logically defines the following variables:

        MQAXP           ExitParms;      /* Exit parameter structure */
        MQAXC           ExitContext;    /* Exit context structure */
        MQLONG          CompCode;       /* Completion code */
        MQLONG          Reason;         /* Reason code */

The queue manager then logically calls the exit as follows:

MQ_TERM_EXIT (&ExitParms, &ExitContext, &CompCode, &Reason)

Your exit must match the following C function prototype:

void MQENTRY MQ_TERM_EXIT (
PMQAXP          pExitParms,     /* Address of exit parameter structure */
PMQAXC          pExitContext,   /* Address of exit context structure */
PMQLONG         pCompCode,      /* Address of completion code */
PMQLONG         pReason);       /* Address of reason code qualifying
                                   completion code */