MQeFieldsEquals

Description
Compares two typed MQeFields objects and determine if they both have the same fields.

This API determines if two MQeFields objects are the same by comparing every visible field in the first object with the corresponding visible field in the second object. If the second object does not have a corresponding visible field, or its value is different, then the two MQeFields objects are considered unequal, and the result is '0'. If the two MQeFields objects are not unequal, then the result depends on whether the second MQeFields object contains exactly the same number of visible fields, in which case the result is '1', or more visible fields, in which case the result is '2'. This comparison does not depend on the order in which the fields are inserted or stored in each of the MQeFields objects; all that matters is that both MQeFields objects contain the same fields. The types of the MQeFields objects do not affect the result of the comparison, however both MQeFields objects must be typed (they may not be allocated with type MQE_OBJECT_TYPE_MQE_FIELDS_UNTYPE). The test recurses into nested fields.

Syntax
#include <hmq.h>
MQEINT32 MQeFieldsEquals( MQEHSESS hSess, 
									MQEHFIELDS hFlds1, 
									MQEHFIELDS hFlds2, 
             					MQEINT32 * pCompCode, 
									MQEINT32 * pReason) 

Parameters

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

MQEHFIELDS hFlds1 - input
The first MQeFields object handle.

MQEHFIELDS hFlds2 - input
The second MQeFields object handle.

MQEINT32 * pCompCode - output
MQECC_OK, MQECC_WARNING or MQECC_ERROR.

MQEINT32 * pReason - output

MQE_EXCEPT_INVALID_HANDLE

MQE_EXCEPT_ALLOCATION_FAILED

Return Value

Example
#include <hmq.h>
static MQECHAR const * FieldsType = "com.ibm.mqe.MQeFields";
MQEHSESS  hSess;
MQEINT32  compcode;
MQEINT32  reason;
MQEHFIELDS hFlds1, hFlds2;
MQEINT32  rc;
 
hSess  = MQeInitialize("MyAppsName", &compcode, &reason );
hFlds1 = MQeFieldsAlloc( hSess, FieldsType, &compcode, &reason);
hFlds2 = MQeFieldsAlloc( hSess, FieldsType, &compcode, &reason);
 
/*
 * Add some fields to the fields objects... and one of them is "XYZ"
 */
 ...
 
/*
 * Now test their equivalence
 */
rc = MQeFieldsEquals( hSess, hFlds1, hFlds2, &compcode, &reason);
 

See Also MQeFieldsHide.


© IBM Corporation 2002. All Rights Reserved