I’m using mo01 java support pack to read event messages from SYSTEM.ADMIN.CHANNEL.EVENT Queue .
Below is the link to code:
I can able to read all parameter name/value from the PCF Message consumed from channel event queue except the below parameter,
ReasonQualifier Specifies the identifier that qualifies the reason code. Identifier MQIACF_REASON_QUALIFIER. Datatype MQCFIN. Values One of the following: MQRQ_CHANNEL_STOPPED_OK Channel has been closed with either a zero return code or a warning return code. MQRQ_CHANNEL_STOPPED_ERROR Channel has been closed, but there is an error reported and the channel is not in stopped or retry state. MQRQ_CHANNEL_STOPPED_RETRY Channel has been closed and it is in retry state. MQRQ_CHANNEL_STOPPED_DISABLED Channel has been closed and it is in a stopped state. Returned Always.
Below is the part of code,
Map reasonCodes = new HashMap();
/** Map of MQ command names and values. */
Map commands = new HashMap();
/** Map of MQ string names and values. */
Map stringNames = new HashMap();
private String getStringName(int stringInt)
{
return (String)stringNames.get(new Integer(stringInt));
}
/**
* Converts a constant integer to its MQ command name.
* @param stringInt the MQ integer.
* @return the MQ command name represented by the constant integer.
*/
private String getCommandName(int stringInt)
{
return (String)commands.get(new Integer(stringInt));
}
// Below methods retrieves int code's string value from classes and store in HashMap
public void setupMaps()
{
setupReasonNameSub("com.ibm.mq.pcf.CMQC", "MQRC", reasonCodes);
setupReasonNameSub("com.ibm.mq.pcf.CMQCFC", "MQRC", reasonCodes);
setupReasonNameSub("com.ibm.mq.pcf.CMQCFC", "MQCMD", commands);
setupReasonNameSub("com.ibm.mq.pcf.CMQC", "MQCA", stringNames);
setupReasonNameSub("com.ibm.mq.pcf.CMQCFC", "MQCA", stringNames);
setupReasonNameSub("com.ibm.mq.pcf.CMQC", "MQIA", stringNames);
setupReasonNameSub("com.ibm.mq.pcf.CMQC", "MQRQ", reasonCodes);
}
void readPCFMessage(PCFMessage pcfMessage){
Enumeration pcfEnum = pcfMessage.getParameters();
stdout =
stdout + "" + getReasonName(pcfMessage.getReason()) + "\n";
while (pcfEnum.hasMoreElements())
{
String parameterName;
PCFParameter elt = (PCFParameter)pcfEnum.nextElement();
parameterName = getStringName(elt.getParameter());
stdout = stdout + "";
if (elt.getType() == CMQCFC.MQCFT_STRING_LIST)
{
String strings[] = (String[])elt.getValue();
for (int i = 0; i " + strings[i] + "\n";
}
}
else
stdout = stdout + elt.getValue().toString();
stdout = stdout + "\n";
}
System.out.println(stdout);
}
Output:
MQRC_CHANNEL_STOPPED
QMGR1
CHL.TO.CHLA
SYSTEM.CLUSTER.TRANSMIT.QUEUE
172.21.33.123
9
0
0
0
CHL.TO.CHLA
If a channel is stopped , I want to know the exact reason on whether it is stopped with a issue or a normal OK. This parameter tells us the right reason on channel stopped.
Any idea why this parameter is not retrievable?
The Event Messages/Channel Stopped page in the Infocenter lists all the fields in a returned PCF message. I have mapped out the fields to the responses you posted:
The
cmqc.hfile maps the reason codes to their macros as follows:I suspect that if you were to print the hash keys as well as the values, that integer 9 you got back would represent the
MQIACF_REASON_QUALIFIERyou claim to have not received, as well as sorting out which of the strings are returned null. The one value that seems out of place is the extra channel name and I believe that is actually theAuxErrorDataStr1but I mapped it as ???? since it’s not possible to tell for sure from the information provided.If I can anticipate your next question, it might be “OK, so if the reason qualifier says the channel went to retry, where is the
ErrorIdentifier?” The answer to that is thatMQRQ_CHANNEL_STOPPED_RETRYis not an error. It is a normal channel state. The description of theErrorIdentifierfield states that if the channel is stopped due to an error theReasonQualifierfield will contain the valueMQRQ_CHANNEL_STOPPED_ERROR. In this case,ReasonQualifiercontainsMQRQ_CHANNEL_STOPPED_RETRYsoErrorIdentifieris not expected to contain anything.Incidentally, note that
MQRQ_CHANNEL_STOPPED_*is a bit of a misnomer. A channel inRETRYis not considered to have stopped. It is in an intermediate state betweenRUNNINGandSTOPPEDwhere it might yet end up once the retries are exhausted or might revert back toRUNNINGif the retries are successful. However, the event is generated to record the channel changing from a running or idle state to something less functional.To directly answer your question “Any idea why this parameter is not retrievable?” I challenge the premise that the parameter is not retrievable. Modify the code to print the key as well as the value and I believe it will show that integer 9 value as the reason qualifier you are looking for.