MQeFields

MQeFields is the fundamental class used to hold data items for sending, receiving, or manipulating WebSphere MQ Everyplace messages. An MQeFields object is constructed as follows:

MQeFieldsHndl hNewFields;
	MQERETURN rc;
	rc = mqeFields_new(&errStruct, &hNewFields);

There are various put and get functions within the MQeFields object for storing and retrieving items. Items are held in a name, type and value form.

The name must conform to the following rules:

Note:
Java 1.4 and earlier versions, are not capable of handling Unicode codepoints larger than six charaters. As a result, bindings cannot put unicode strings containing chars larger than two bytes successfully, although Java will not complain.

The MQeFields object name is used to retrieve and update values. It is good practice to keep names short, because the names are included with the data when the MQeFields object is dumped.

The following examples shows how to store values in an MQeFields object:

MQeStringHndl hFieldName;
	rc = mqeString_newChar8(&errStruct,	&hFieldName, "A Field Name");
	rc = mqeFields_putInt32(hNewFields,&errStruct,hFieldName,1234);

The following example shows how to retrieve values from an MQeFields object:

MQEINT32 value;
	rc = mqeFields_getInt32(hNewFields, &errStruct, &value, hFieldName);

Arrays of values may be held within a fields object. There are two forms for holding arrays, fixed length, and variable length. A function of the form shown in the following example is used to store the arrays. The boolean option is set to MQE_TRUE for variable length.

MQERETURN mqeFields_putDoubles(MQeFieldsHndl hFields, 
					 MQeExceptBlock * pErrStruct, 
					 MQECONST MQeStringHndl hFieldName, 
					 MQECONST MQEDOUBLE * pDoubles, 
					 MQEINT32 arrLength, 
					 MQEBOOL multiFieldsRep);

Bytes are a special case, as they can handle multi-dimensional arrays.

For one byte
MQERETURN mqeFields_putByte(	MQeFieldsHndl hFields, 
					MQeExceptBlock * pErrStruct, 
					MQECONST MQeStringHndl hFieldName, 
					MQEBYTE input);

For a 1-dimensional array of bytes
In effect this is a fixed length array.
MQERETURN mqeFields_putBytes(MQeFieldsHndl hFields, 
					MQeExceptBlock * pErrStruct, 
					MQECONST MQeStringHndl hFieldName, 
					MQECONST MQEBYTE * pBytes, 
					MQEINT32 arrLength);	

For a 2-dimensional array of bytes
This is in effect a variable length array.
MQERETURN mqeFields_putByteArray(MQeFieldsHndl hFields, 
						MQeExceptBlock * pErrStruct, 
						MQECONST MQeStringHndl hFieldName, 
						MQECONST MQEBYTE ** ppBytes, 
						MQECONST MQEINT32 * pLenOfByteSeqs, 
						MQEINT32 arrLength);

To retrieve arrays, get functions can be used as required. There is only one form:

mqeFields_getXXXs()


© IBM Corporation 2000, 2003. All Rights Reserved