Programming hints and tips

The following hints and tips are in no significant order. They are subjects that, if relevant to the work you are doing, might save you time.

Message Descriptor properties

Where an WebSphere MQ application is the originator of a message and WebSphere MQ generates the

you are recommended to use the AccountingTokenHex, CorrelationIdHex, GroupIdHex, and MessageIdHex properties if you want to look at their values, or manipulate them in any way - including passing them back in a message to WebSphere MQ. The reason for this is that WebSphere MQ generated values are strings of bytes that have any value from 0 through 255 inclusive, they are not strings of printable characters.

Where your MQAX script is the originator of a message and you generate the

you can use either the AccountingToken, CorrelationId, GroupId, or MessageId properties or their Hex equivalents.

WebSphere MQ constants

WebSphere MQ constants are provided as members of the enum MQ in library MQAX200.

WebSphere MQ string constants

WebSphere MQ string constants are not available when using WebSphere MQ Automation Classes for ActiveX. You must use the explicit character string for those shown below and any others you may need:

MQFMT_NONE
MQFMT_ADMIN
MQFMT_CHANNEL_COMPLETED
MQFMT_CICS
MQFMT_COMMAND_1
MQFMT_COMMAND_2
MQFMT_DEAD_LETTER_HEADER
MQFMT_DIST_HEADER
MQFMT_EVENT
MQFMT_IMS
MQFMT_IMS_VAR_STRNG
MQFMT_MD_EXTENSION
MQFMT_PCF
MQFMT_REF_MSG_HEADER
MQFMT_RF_HEADER
MQFMT_STRING
MQFMT_TRIGGER
MQFMT_WORK_INFO_HEADER
MQFMT_XMIT_Q_HEADER

" "
"MQADMIN "
"MQCHCOM "
"MQCICS "
"MQCMD1 "
"MQCMD2 "
"MQDEAD "
"MQHDIST "
"MQEVENT "
"MQIMS "
"MQIMSVS "
"MQHMDE "
"MQPCF "
"MQHREF "
"MQHRF "
"MQSTR "
"MQTRIG "
"MQHWIH "
"MQXMIT "

Null string constants

The WebSphere MQ constants, used for the initialization of four MQMessage properties, MQMI_NONE (24 NULL characters), MQCI_NONE (24 NULL characters), MQGI_NONE (24 NULL characters), and MQACT_NONE (32 NULL characters), are not supported by WebSphere MQ Automation Classes for ActiveX. Setting them to empty strings has the same effect.

For example, to set the various ids of an MQMessage to these values:
mymessage.MessageId = ""
mymessage.CorrelationId = ""
mymessage.AccountingToken = ""

Receiving a message from WebSphere MQ

There are several ways of receiving a message from WebSphere MQ:

Issuing a GET with the Wait option and setting the WaitInterval to MQWI_UNLIMITED causes your system to lock up until the GET call completes, if the process is singlethreaded.



© IBM Corporation 2002. All Rights Reserved