MQeQMgrUndo

Description
Undo the previous MQeQMgrBrowseMsgs(), or MQeQMgrGetMsg() or MQeQMgrPutMsg(), or combination of these operations on a message, or a set of messages that have the same ConfirmID value. If the previous operation on the message objects was MQeQMgrBrowseMsgs() with lock, the messages objects are unlocked and made accessible again. If the previous operation on the message objects was MQeQMgrGetMsg(), the message object is put back onto the queue. If the previous operation was MQeQMgrPutMsg(), the message object is deleted from the queue.

Syntax
#include <hmq.h>
MQEVOID MQeQMgrUndo( MQEHSESS hSess, MQECHAR * pQMName,
                     MQECHAR * pQName,  MQEINT64 * pConfirmId, 
                     MQEINT32 * pCompCode, MQEINT32 * pReason) 

Parameters

MQEHSESS hSess - input
The session handle, returned by MQeInitialize.

MQECHAR * pQMName - input
A null terminated string containing the name of the queue manager.

MQECHAR * pQName - input
A null terminated string containing the name of the queue.

MQEINT64 * pConfirmId - input
A 64 bit integer ConfirmID that was used on previous operations on the message objects.

MQEINT32 * pCompCode - output
MQECC_OK, MQECC_WARNING or MQECC_ERROR.

MQEINT32 * pReason - output
If the returned *pCompCode equals MQECC_ERROR, *pReason may have any of the following values:

MQE_EXCEPT_INVALID_HANDLE

MQE_EXCEPT_QMGR_INVALID_QMGR_NAME

MQE_EXCEPT_QMGR_INVALID_Q_NAME

MQE_EXCEPT_QMGR_UNKNOWN_QMGR

MQE_EXCEPT_QMGR_Q_DOES_NOT_EXIST

MQE_EXCEPT_Q_NO_MSG_AVAILABLE

MQE_EXCEPT_NOT_FOUND

MQE_EXCEPT_INVALID_ARGUMENT

MQE_EXCEPT_NETWORK_ERROR_OPEN|READ|WRITE

Return Value

MQEVOID

Example
#include <hmq.h>
static const MQECHAR pHello[] = "Hello world.";
MQEHSESS   hSess;
MQEHFIELDS hMsg;
MQEINT32   rc;
MQEINT32   compcode;
MQEINT32   reason;
MQEPMO     pmo = MQEPMO_DEFAULT;
MQECHAR    * qm, *q;
 
qm = "aQM";
q  = "QQ";
 
hSess = MQeInitialize("MyAppsName", &compcode, &reason);
hMsg  = MQeFieldsAlloc( hSess, MQE_OBJECT_TYPE_MQE_MSGOBJECT, 
                       &compcode, &reason);
MQeFieldsPut(hSess, hMsg, "hi", MQE_TYPE_ASCII, pHello, sizeof(pHello), 
            &compcode, &reason);
 
/* Put msg with confirmID, the Undo*/
 
pmo.ConfirmId.hi = 0x2222;
pmo.ConfirmId.lo = 0x1111;
pmo.Options     |= MQE_QMGR_OPTION_CONFIRMID;
 
/* Put 200 messages onto the queue. */
for (i=0; i<200; i++) {
   MQeQMgrPutMsg( hSess, qm, q, &pmo, hMsg, &compcode, &reason);
}
 
/* Undo the 200 putmsg operations. */
MQeQMgrUndo( hSess, qm, q, pmo.ConfirmId, &compcode, &reason);
 
/* Free the message handle */
MQeFieldsFree( hSess, hMsg, &compcode, &reason);
MQeTerminate( hSess, &compcode, &reason);

See Also



© IBM Corporation 2002. All Rights Reserved