gtpc2m4yC/C++ Language Support User's Guide

MQDISC-Disconnect Queue Manager

This function disconnects the application from a TPF MQSeries queue manager.

Format

#include  <cmqc.h>
void      MQDISC(PMQHCONN pHconn,
                 PMQLONG pCompCode,
                 PMQLONG pReason);

pHconn
A pointer to the location to store the connection handle, which represents the connection to the TPF MQSeries queue manager. You must specify the connection handle on all subsequent message queuing calls issued by the application. The value of pHconn was returned by a previous MQCONN call.

pCompCode
A pointer to the location to store the completion code, which is one of the following:

MQCC_OK
Successfully completed.

MQCC_FAILED
The call failed.

pReason
A pointer to the location to store the reason code that qualifies the completion code.

If the completion code is MQCC_OK, the reason code is MQRC_NONE, which indicates a normal return.

If the completion code is MQCC_FAILED, see Error Return for the corresponding reason codes.

See MQSeries Application Programming Reference and MQSeries Message Queue Interface Technical Reference for more information about MQSeries data types and parameters.

Normal Return

MQCC_OK
Completion code completed successfully.

MQRC_NONE
Reason code completed successfully.

Error Return

If the completion code is MQCC_FAILED, the function failed with the following reason code:

MQRC_HCONN_ERROR
The connection handle is not valid.

Programming Considerations

If the Hconn parameter is not for a local TPF MQSeries queue manager, this MQDISC function call will be sent by TPF MQSeries client support to the remote queue manager for processing. The options supported by the remote queue manager can differ from the options specified for the local TPF MQSeries queue manager.

Examples

The following example disconnects the application from the queue manager.

#include <cmqc.h>
 
MQLONG  CompCode;                        /* completion code        */
MQLONG  Reason;                          /* reason code            */
MQHCONN Hcon;                            /* Connection Handle      */

  ·
  ·
  ·
/*********************************************/ /*DISCONNECT FROM QUEUE MANAGER */ /*********************************************/ /* Hcon from previous MQCONN */ MQDISC(&Hcon, &CompCode, &Reason); if(Reason != MQRC_NONE) printf("MQDISC ended with reason code %d.\n",Reason);
  ·
  ·
  ·

Related Information