gtpc2m4wC/C++ Language Support User's Guide

MQCMIT-Commit a Queue

This function indicates to the queue manager that the application has reached a syncpoint, and that all MQPUT, MQPUT1, and MQGET function calls that have occurred since the last syncpoint are to be made permanent. Messages put as part of a unit of work are made available to other applications; messages retrieved as part of a unit of work are deleted. This call is available only for remote client programs. For local TPF MQSeries applications, use tx_commit.

Format

#include  <cmqc.h>
void      MQCMIT (MQHCONN Hconn,
                 PMQLONG pCompCode,
                 PMQLONG pReason);

Hconn
The connection handle, which represents the connection to the TPF MQSeries queue manager. The value of Hconn 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_WARNING
Partially 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_WARNING, see Error Return for the corresponding reason codes.

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_WARNING or MQCC_FAILED, the function failed with one of the following reason codes:

MQRC_BACKED_OUT
A severe error occurred during a unit of work or the unit of work was backed out.

MQRC_CONNECTION_BROKEN
The connection to the queue manager is lost.

MQRC_HCONN_ERROR
The connection handle is not valid.

MQRC_OBJECT_DAMAGED
An object is damaged.

MQRC_Q_MGR_STOPPING
The queue manager is stopping.

MQRC_STORAGE_NOT_AVAILABLE
There is not enough storage available.

MQRC_UNEXPECTED_ERROR
An unexpected error occurred.

Programming Considerations

If the Hconn parameter is not for the local TPF MQSeries queue manager, this MQCMIT 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 commits a unit of work.

#include <cmqc.h>
 
MQLONG  CompCode;                        /* completion code        */
MQLONG  Reason;                          /* reason code            */
MQHCONN Hconn;                           /* Connection Handle      */
 
/* Hconn from previous MQCONN MQOPEN                       */
MQCMIT(hCon,&CompCode,&Reason);
 
if(Reason == MQRC_NONE)
   printf("Unit of work successfully completed\n");

Related Information