views:

272

answers:

1

I can get the event messages from the queue. I get the message properties. I am pretty sure the MQEVENT type is in PCF format but I cannot seem to find any good documentation on how to take that message and convet it into human readable format.

AccountingToken
ApplicationIdData
ApplicationOriginData
BackoutCount 0
BackoutCount 0
CharacterSet 437
CompletionCode 0
CorrelationId System.Byte[]
DataLength 236
DataOffset 0
Encoding 546
Expiry -1
Feedback 0
Format MQEVENT
GroupId System.Byte[]
MessageFlags 0
MessageId System.Byte[]
MessageLength 236
MessageSequenceNumber 1
MessageType 8
Offset 0
OriginalLength -1
Persistence 0
Priority 0
PutApplicationName NTPMFG01
PutApplicationType 7
PutDateTime 3/19/2010 10:29:08 PM
ReasonCode 0
ReasonName MQRC_OK
ReplyToQueueManagerNameNTPMFG01
ReplyToQueueName
Report 0
TotalMessageLength 236
UserId
Version 1

And here is the message.
$ ? - ? ? ? ? D ¯ 0 MFG01 ? D - 0 MF G.CUST.CAT ? ? # ¤ ? ? $ ? ? ? % ? ? & ?

+1  A: 

if (myMQMessage.Format.CompareTo(MQC.MQFMT_EVENT) == 0) I think it needs to be processed twice. First process the PCF header with MQCFH

BuildMQCFH(new IBM.WMQ.PCF.MQCFH(myMQMessage));

public void BuildMQCFH(IBM.WMQ.PCF.MQCFH eventMessageHeader) {
  int reasonForEvent = eventMessageHeader.Reason;
}

Then you MUST reset the DataOffset to 0

myMQMessage.DataOffset = 0;

Second process the PCF parameters with PCFParameter. BuildPcfMessage(new IBM.WMQ.PCF.PCFMessage(myMQMessage));

public void BuildPcfMessage(IBM.WMQ.PCF.PCFMessage pcfMessage) {
  IBM.WMQ.PCF.PCFParameter[] pcfParameters = pcfMessage.GetParameters();
  afflictedQueueManager = pcfParameters[0].GetValue().ToString();
  afflictedQueue = pcfParameters[1].GetValue().ToString();
}

MQMessage, PCF.PCFMessage and MQCF each do a readbyte(s) moving the offset with out resetting afterwards.

Phil Langeberg