#include <hmq.h> #include <hmqHelper.h> MQEINT32 MQeFieldsGetArrayLength( MQEHSESS hSess, MQEHFIELDS hFlds, MQECHAR * pName, MQEINT32 * pCompCode, MQEINT32 * pReason)
#include <hmq.h> #include <:hmqHelper.h> static MQECHAR const * FieldsType = "com.ibm.mqe.MQeFields"; MQEHSESS hSess; MQEINT32 compcode; MQEINT32 reason; MQEHFIELDS hFlds; MQEBYTE datatype; MQEINT32 data[2], n; MQEINT32 * pData; MQEINT32 rc; hSess = MQeInitialize("MyAppsName", &compcode, &reason); hFlds = MQeFieldsAlloc( hSess, FieldsType, &compcode, &reason); data[0] = 0x12345678; data[1] = 0xDEADBEEF; rc = MQeFieldsPutIntArray(hSess, hFlds, "foo", data, 2, &compcode, &reason); /* Get the data length */ n = MQeFieldsGetArrayLength( hSess, hFlds, "foo", &compcode, &reason ); datatype= MQE_TYPE_INT; pData = malloc(n * MQE_SIZEOF(datatype)); /* Copy out the data */ rc = MQeFieldsGetIntArray( hSess, hFlds, "foo", pData, 0, n, &compcode, &reason );