#include <hmq.h> MQEINT32 MQeFieldsGet( MQEHSESS hSess, MQEHFIELDS hFlds, MQECHAR * pName, MQEBYTE * pDataType, MQEVOID * pData, MQEINT32 nElements, MQEVOID *pBase, MQEINT32 * pCompCode, MQEINT32 * pReason)
If data type is MQE_TYPE_FIELDS, then a single field object handle MQEHFIELDS is returned.
If data type is MQE_TYPE_UNTYPED, then it is treated as an array of bytes.
#include <hmq.h> static MQECHAR const * FieldsType = "com.ibm.mqe.MQeFields"; MQEHSESS hSess; MQEINT32 compcode; MQEINT32 reason; MQEHFIELDS hFlds; MQEBYTE datatype; MQEINT32 n; MQEBYTE * pdata; MQEBYTE * buf; MQEINT32 rc; hSess = MQeInitialize("MyAppsName", &compcode, &reason); hFlds = MQeFieldsAlloc( hSess, FieldsType, &compcode, &reason); /* * Add some fields to the fields object... and one of them is "XYZ" */ ... /* Get the field data length */ n = MQeFieldsGet( hSess, hFlds, "XYZ", &datatype, NULL, 0, NULL, &compcode, &reason); /* Verfify that datatype is correct. */ /* Get some space to put the data */ buf = (MQEBYTE *)calloc(n, MQE_SIZEOF(datatype)); /* Get the field data */ rc = MQeFieldsGet( hSess, hFlds, "XYZ", &datatype, &buf, n, NULL, &compcode, &reason);