1
votes

I'm using mo01 java support pack to read event messages from SYSTEM.ADMIN.CHANNEL.EVENT Queue .

Below is the link to code:

mo01java

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?

1
Hard to say without more detail. When you say the parameter is "not retrievable" does that mean it isn't in the PCF message? That it is there but the application silently omits it? That an error is thrown? Also, the SupportPac says it hasn't been updated since 2008. If it uses the old PCF jars and conflicts with the new jars, you may have issues there. But that would depend on what version of WMQ server and client you have installed, CLASSPATH and how you are executing MO01 and none of those details were provided either. Can you provide more detail of the config and error? - T.Rob
I can see the reason qualifier value in the message , but the program didn't get the parameter name and value. - Vignesh
Added part of my code.. My QMGR is MQv7 . - Vignesh

1 Answers

0
votes

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:

QMgrName          MQCFST QMGR1
ReasonQualifier   MQCFIN 9
ChannelName       MQCFST CHL.TO.CHLA
ErrorIdentifier   MQCFIN 0
AuxErrorDataInt1  MQCFIN 0
AuxErrorDataInt2  MQCFIN 0
AuxErrorDataStr1  MQCFST ""
AuxErrorDataStr2  MQCFST ""
AuxErrorDataStr3  MQCFST ""
XmitQName         MQCFST SYSTEM.CLUSTER.TRANSMIT.QUEUE
ConnectionName    MQCFST 172.21.33.123

????              MQCFST CHL.TO.CHLA (See below)

The cmqc.h file maps the reason codes to their macros as follows:

 #define MQRQ_CHANNEL_STOPPED_OK        7
 #define MQRQ_CHANNEL_STOPPED_ERROR     8
 #define MQRQ_CHANNEL_STOPPED_RETRY     9
 #define MQRQ_CHANNEL_STOPPED_DISABLED  10

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_QUALIFIER you 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 the AuxErrorDataStr1 but 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 that MQRQ_CHANNEL_STOPPED_RETRY is not an error. It is a normal channel state. The description of the ErrorIdentifier field states that if the channel is stopped due to an error the ReasonQualifier field will contain the value MQRQ_CHANNEL_STOPPED_ERROR. In this case, ReasonQualifier contains MQRQ_CHANNEL_STOPPED_RETRY so ErrorIdentifier is not expected to contain anything.

Incidentally, note that MQRQ_CHANNEL_STOPPED_* is a bit of a misnomer. A channel in RETRY is not considered to have stopped. It is in an intermediate state between RUNNING and STOPPED where it might yet end up once the retries are exhausted or might revert back to RUNNING if 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.