MQeFieldsPutAscii, MQeFieldsPutUnicode, MQeFieldsPutObject

Description
Put an array of MQECHAR, MQESHORT, or MQEBYTE into a single field of the MQeFields object.

Syntax
#include <hmq.h> 
#include <hmqHelper.h> 
MQEINT32 MQeFieldsPutAscii( MQEHSESS hSess, 
					MQEHFIELDS hFlds, MQECHAR * pName, 
              MQECHAR * pData, MQEINT32 DataLen, 
              MQEINT32 * pCompCode, MQEINT32 * pReason) 
 
MQEINT32 MQeFieldsPutUnicode( MQEHSESS hSess, 
					MQEHFIELDS hFlds, MQECHAR * pName, 
              MQESHORT * pData, MQEINT32 DataLen, 
              MQEINT32 * pCompCode, MQEINT32 * pReason) 
 
MQEINT32 MQeFieldsPutObject( MQEHSESS hSess, 
					MQEHFIELDS hFlds, MQECHAR * pName, 
              MQEBYTE * pData, MQEINT32 DataLen, 
              MQEINT32 * pCompCode, MQEINT32 * pReason)

Parameters

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

MQEHFIELDS hFlds - input
A handle to an MQeFields object.

MQECHAR * pName - input
A null terminated string name of the field. A null or a zero length string is invalid.

MQECHAR * pStr - input
Field data.

MQESHORT * pStr - input
Field data.

MQEBYTE * pStr - input
Field data.

MQEINT32 DataLen - input
The maximum number of MQECHAR, MQESHORT, or MQEBYTE to copy.

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_INVALID_ARGUMENT

MQE_EXCEPT_ALLOCATION_FAILED

Return Value

MQEINT32
Returns '0' on success or '-1' on failure.

Example
#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 hFlds;
MQEINT32  n;
MQEBYTE * pData;
MQEINT32  rc;
 
hSess  = MQeInitialize("MyAppsName", 
								&compcode, &reason);
hFlds  = MQeFieldsAlloc( hSess, FieldsType, 
								&compcode, &reason);
rc   = MQeFieldsPutAscii( hSess, hFlds, "ibm", 
									strlen(textVal)), textVal, 
              				&compcode, &reason); 
 
/* Get the data length */
n    = MQeFieldsDataLen( hSess, hFlds, "ibm", 
								&compcode, &reason);
 
pData  = (MQEBYTE *) 
			calloc(n, , MQE_SIZEOF(datatype));
 
/* Copy out the data */
rc   = MQeFieldsGetAscii( hSess, hFlds, "ibm", 
									pData, n, 
              				&compcode, &reason);

See Also



© IBM Corporation 2002. All Rights Reserved