#include <hmq.h> #include <hmqHelper.h> MQEINT32 MQeFieldsCopy( MQEHSESS hSess, MQEHFIELDS hSrcFlds, MQEHFIELDS hDstFlds, MQEINT32 Option, MQECHAR * pName, MQEINT32 * pCompCode, MQEINT32 * pReason)
Returns '0' on success, or '-1' on failure.
#include <hmq.h> #include <hmqHelper.h> static MQECHAR const * FieldsType = "com.ibm.mqe.MQeFields"; static const MQECHAR * textVal = "The Owl and the Pussy Cat went to sea"; MQEHSESS hSess; MQEINT32 compcode; MQEINT32 reason; MQEHFIELDS hFlds1, hFlds2; MQEINT32 n; MQEBYTE * pData; MQEINT32 rc; hSess = MQeInitialize("MyAppsName", &compcode, &reason); hFlds1 = MQeFieldsAlloc( hSess, FieldsType, &compcode, &reason); rc = MQeFieldsPut( hSess, hFlds1, "ibm", MQE_TYPE_UNICODE, strlen(textVal)), textVal, &compcode, &reason); MQeFieldsCopy( hSess, hFlds1, hFlds2, MQE_FIELDS_OPTION_ALL_FIELDS, NULL, &compcode, &reason); n = MQeFieldsDataLen( hSess, hFlds2, "ibm", &compcode, &reason); pData = (MQEBYTE *) calloc(n, MQE_SIZEOF(datatype)); /* Copy out the data */ rc = MQeFieldsGetAscii( hSess, hFlds2, "ibm", pData, n, &compcode, &reason);