ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » General IBM MQ Support » Getting Channel details from QM running with CCSID 1381

Post new topic  Reply to topic
 Getting Channel details from QM running with CCSID 1381 « View previous topic :: View next topic » 
Author Message
pavan-mq
PostPosted: Fri Jan 21, 2011 1:31 pm    Post subject: Getting Channel details from QM running with CCSID 1381 Reply with quote

Novice

Joined: 03 Feb 2010
Posts: 13

Hi,

I have a MQ running(with CCSID 1381) on Win2003 server in Simple Chinese. I want to send PCF messages to collect basic data about the QM.

If I do not mention the CCSID in the client code I get :
Code:
MQJE001: An MQException occurred: Completion Code 2,Reason 2195
MQJE020: CCSID not supported by queue manager


If I do it (set CCSID in java code to 1381) then I get following:
Code:
MQJE001: Completion Code 2, Reason 2119


I get the above error even if I try the code from the S.Chinese box.
This is the code snippet:

Code:
MQEnvironment.CCSID = 1381;

agent = new PCFMessageAgent (host, port, "SYSTEM.DEF.SVRCONN");

i am making use of the above agent for getting queue details, channel details and listner details by passing it to seperate methods.

queuedetails:
----------------
Code:
request = new PCFMessage (CMQCFC.MQCMD_INQUIRE_Q);
request.addParameter (CMQC.MQCA_Q_NAME, "*");
request.addParameter (CMQC.MQIA_Q_TYPE, CMQC.MQQT_LOCAL);

int [] attrs={ CMQC.MQCA_Q_NAME,
CMQC.MQIA_CURRENT_Q_DEPTH,
CMQC.MQIA_OPEN_INPUT_COUNT,
CMQC.MQIA_OPEN_OUTPUT_COUNT,
CMQC.MQIA_MAX_Q_DEPTH,
CMQC.MQIA_DEFINITION_TYPE}
request.addParameter (CMQCFC.MQIACF_Q_ATTRS,attrs);
responses = agent.send (request);



channel details:
------------------
Code:
PCFMessage    request = new PCFMessage (CMQCFC.MQCMD_INQUIRE_CHANNEL_STATUS);

int[] attrs = {CMQCFC.MQCACH_CHANNEL_NAME,
                        CMQCFC.MQCACH_CONNECTION_NAME,
                        CMQCFC.MQIACH_MSGS,
                        CMQCFC.MQCACH_LAST_MSG_DATE,
                        CMQCFC.MQCACH_LAST_MSG_TIME,
                        CMQCFC.MQIACH_BYTES_SENT,
                        CMQCFC.MQIACH_BYTES_RECEIVED,
                        CMQCFC.MQIACH_BUFFERS_RECEIVED,
                        CMQCFC.MQIACH_BUFFERS_SENT,
                        CMQCFC.MQIACH_CHANNEL_STATUS};
 request.addParameter
(CMQCFC.MQIACH_CHANNEL_INSTANCE_ATTRS, attrs);

responses = agent.send(request);


i was getting the below error while getting channel details and listener details and not for queue details.

Code:
com.ibm.mq.pcf.PCFException: MQJE001: ????? 2,??? 2119
com.ibm.mq.pcf.PCFMessageAgent.send(PCFMessageAgent.java:251)


Changing the CCSID is not a solution because many applications are dependent on the QM with CCSID 1381.

Am i missing any thing? i have already gone through all the MQseries.net site for this reason code and ccsid. Please help me solve this issue.

I guess this is all because of conversion. Is it possible to disable the conversion display the original characters..? All i need is to get the details.

Please help me find solution.
Back to top
View user's profile Send private message
pavan-mq
PostPosted: Sun Jan 23, 2011 10:20 am    Post subject: Reply with quote

Novice

Joined: 03 Feb 2010
Posts: 13

I was expecting the reply from you guys..
Back to top
View user's profile Send private message
mqjeff
PostPosted: Sun Jan 23, 2011 11:11 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

I've not had a free moment to set up a qmgr using CCSID 1381.

MQRC 2119 is MQRC_NOT_CONVERTED.

I suspect that the correct thing is not being done to set the CCSID on the PCF request or PCF reply (the reply would require a PMR to resolve, and may be complicated to diagnose... ).

I might try using the PCFMessage.write() method to turn the PCFMessage into an MQMessage and then double-check the CCSID and etc.

I'd also take another few moments and review and make sure that you haven't actually set "illegal" characters in the MQ objects.

Also, does MQExplorer have any issues talking to this qmgr? If not, then it's fundamentally an issue with your code rather than the qmgr.
Back to top
View user's profile Send private message
Vitor
PostPosted: Sun Jan 23, 2011 11:14 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

pavan-mq wrote:
I was expecting the reply from you guys..


1) We're not a support desk with an SLA
2) Only the dedicated (or social disadvantaged) are on here at weekends
3) Only a %age of the posters are likely to have used Simplified Chinese
4) Only a %age of those will have used PCF on the box in question

So not getting a response should not be that unexpected.

Here's an idea - raise a PMR. That does have an SLA, and IBM are bound to have someone who has used PCF on a Chinese box.

As a license paying customer you have that right.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
pavan-mq
PostPosted: Sun Jan 23, 2011 11:16 pm    Post subject: Reply with quote

Novice

Joined: 03 Feb 2010
Posts: 13

Hi Jeff,

Thanks for your response. Sorry for my English "the reply".

As of now there is no problem in communication with the QMgr using MQExplorer. I will try PCFMessage.write() and check what CCSID i am getting. Is there any difference in using PCF Message agent and MQMessages??

mqjeff wrote:
Quote:
make sure that you haven't actually set "illegal" characters in the MQ objects


Queue and channel names are in Chinese. but they are displaying without issues in MQExplorer.

@vitor: Thanks for your valuable time and advice.

-pavan
Back to top
View user's profile Send private message
mqjeff
PostPosted: Mon Jan 24, 2011 2:24 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

The PCFMessage and PCFMessagAgent classes are helper classes, really. You don't need to use them at all to send PCF messages. It's just easier - less code to write.

If MQExplorer works fine, then the issue is more with your code or the environment that your code is running in. Since you're dealing with character translation issues, you might want to make sure you've got a full MQ Client installed on the machine running the code, and that you've got it on the path and that you have all the right jars on the classpath.
Back to top
View user's profile Send private message
pavan-mq
PostPosted: Mon Jan 24, 2011 6:59 am    Post subject: Reply with quote

Novice

Joined: 03 Feb 2010
Posts: 13

Hi Jeff,

Currently I have copied the below mentioned jars from <Websphere Home>\java\lib and placed it in my jre\lib\ext to make my code work.
    com.ibm.mq.headers.jar
    com.ibm.mq.jar
    com.ibm.mq.jmqi.jar
    com.ibm.mq.pcf.jar
    connector.jar
    com.ibm.mq.commonservices.jar



Quote:
make sure you've got a full MQ Client installed on the machine running the code, and that you've got it on the path and that you have all the right jars on the classpath


Can you please help me specifying the path(Location of jars) which you are referring to?

Thanks in Advance.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Mon Jan 24, 2011 7:42 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

You should not have copied the jar files.

You should have added them, by path, to the CLASSPATH of your java code.
Back to top
View user's profile Send private message
pavan-mq
PostPosted: Fri Jan 28, 2011 3:36 am    Post subject: Reply with quote

Novice

Joined: 03 Feb 2010
Posts: 13

Hi,

I have added the MQClient Jars in classpath instead of copying them, but still no luck.

I am getting the following error
Code:
PCF error:
MQCFH [type: 2, strucLength: 36, version: 1, command: 0 (MQCMD_NONE), msgSeqNumb
er: 1, control: 1, compCode: 2, reason: 2119, parameterCount: 0]


Here I am posting the complete code for your reference. As i said earlier, my QueueManager and code is running on same machine (windows chinese version). MQ is installed with CCSID 1381.

Code:

import java.io.*;
import com.ibm.mq.*;
import com.ibm.mq.headers.MQDataException;
import com.ibm.mq.pcf.*;



public class ListQueueDetails
{
   public static void main (String [] args) throws IOException, MQDataException
   {
      MQQueueManager       qmanager;
      MQQueue         adminQueue, replyQueue;
      String          replyQueueName = "REPLY_QUEUE_PCF";
      MQPutMessageOptions    pmo = new MQPutMessageOptions ();
      MQGetMessageOptions    gmo = new MQGetMessageOptions ();
      MQMessage       message = new MQMessage ();
      String          name = null;
      Integer       depth = null;
      Integer       inCount=null;
      Integer       outCount=null;
      Integer       maxDepth=null;
      Integer         defType=null;

      int []          attrs = new int [] { CMQC.MQCA_Q_NAME,
                               CMQC.MQIA_CURRENT_Q_DEPTH,
                               CMQC.MQIA_OPEN_INPUT_COUNT,
                               CMQC.MQIA_OPEN_OUTPUT_COUNT,
                               CMQC.MQIA_MAX_Q_DEPTH,
                               CMQC.MQIA_DEFINITION_TYPE};
      MQCFH          cfh;
      PCFParameter       p;

      try
      {
         // Turn off unnecessary output before we start
         //MQEnvironment.disableTracing ();
         //MQException.log = null;

         // Connect to the specified queue manager and open queues
         if (args.length == 1)
         {
                            System.out.print ("Connecting to QManager " + args [0] + "... ");
                            qmanager = new MQQueueManager (args [0]);
         }
         else
         {
                            System.out.print ("Connecting to QManager at " + args [0] + ":" + args [1] + " over channel " + args [2]+" ..");
                            MQEnvironment.hostname = args [0];
                            MQEnvironment.port = Integer.parseInt (args [1]);
                            MQEnvironment.channel = args [2];
                            // 1381 is the CCSID of the QueueManager. This code runs from Windows XP(chinese version)
                            MQEnvironment.CCSID=1381;
                            qmanager = new MQQueueManager ("");
         }

         System.out.println ("Connected.");

         // Open PCF request and reply queues

         adminQueue = qmanager.accessQueue (qmanager.getCommandInputQueueName(), MQC.MQOO_OUTPUT, "", "", "mqm");
         replyQueue = qmanager.accessQueue ("SYSTEM.DEFAULT.MODEL.QUEUE", MQC.MQOO_INPUT_EXCLUSIVE, "", replyQueueName, "mqm");

         // Generate and send the request
         message.messageType = MQC.MQMT_REQUEST;
         message.format = MQC.MQFMT_ADMIN;
         message.replyToQueueName = replyQueueName;

         MQCFH.write (message, CMQCFC.MQCMD_INQUIRE_Q, 3);
         MQCFST.write (message, CMQC.MQCA_Q_NAME, "*");
         MQCFIN.write (message, CMQC.MQIA_Q_TYPE, CMQC.MQQT_LOCAL);
         MQCFIL.write (message, CMQCFC.MQIACF_Q_ATTRS, attrs);

         System.out.print ("Sending PCF request... ");
         adminQueue.put (message, pmo);
         System.out.println ("Sent.");

         // Make sure we won't miss the response if it takes a while
         gmo.options = MQC.MQGMO_WAIT | MQC.MQGMO_CONVERT;
         gmo.waitInterval = 100;



         //Getting Header information.......
         try
         {
                            System.out.println("Format==>"+ message.format);
                            System.out.println("CCSID==>"+ message.characterSet);
                            // I am getting 819 as CCSID when i ran this piece of code.
         }
         catch(Exception e)
         {
                            // Ignore these Exceptions...........
         }
         System.out.println ("Queue \t \t curdepth \t \t InputCount \t \t OutputCount \t \t MaxDepth \t \t DefType");

         // Read all the response messages from the reply-to queue
         do
         {
            message.messageId = MQC.MQMI_NONE;
            replyQueue.get (message, gmo);
            cfh = new MQCFH (message);

            // Check the PCF header (MQCFH) in the response message
            if (cfh.reason == 0)
            {
               for (int i = 0; i < cfh.parameterCount; i++)
               {
                  // Extract what we want from the returned attributes
                  p = PCFParameter.nextParameter (message);

                  switch (p.getParameter ())
                  {
                                                    case CMQC.MQCA_Q_NAME:
                                                            name = (String) p.getValue ();
                                                            break;
                                                    case CMQC.MQIA_CURRENT_Q_DEPTH:
                                                            depth = (Integer) p.getValue ();
                                                            break;
                                                    case CMQC.MQIA_OPEN_INPUT_COUNT:
                                                            inCount = (Integer) p.getValue ();
                                                            break;
                                                    case CMQC.MQIA_OPEN_OUTPUT_COUNT:
                                                            outCount = (Integer) p.getValue ();
                                                            break;
                                                    case CMQC.MQIA_MAX_Q_DEPTH:
                                                            maxDepth = (Integer) p.getValue ();
                                                            break;
                                                    case CMQC.MQIA_DEFINITION_TYPE:
                                                            defType = (Integer) p.getValue ();
                                                            break;
                                                    default:
                  }
               }
               if(defType!=1)
                      continue;
               System.out.println ( name + " \t " + depth + "\t " + inCount + "\t " + outCount + "\t " +maxDepth + "\t " +defType);
            }
            else
            {
               System.out.println ("PCF error:\n" + cfh);

               // Walk through the returned parameters describing the error

               for (int i = 0; i < cfh.parameterCount; i++)
               {
                  System.out.println (PCFParameter.nextParameter (message));
               }
            }
         }
         while (cfh.control != CMQCFC.MQCFC_LAST);

         // Disconnect

         System.out.print ("Disconnecting... ");
         qmanager.disconnect ();
         System.out.println ("Done.");
      }

      catch (ArrayIndexOutOfBoundsException abe)
      {
         System.out.println ("Usage: \n" +
            "\tjava ListQueueDepthNoAgent queue-manager\n" +
            "\tjava ListQueueDepthNoAgent host port channel");
      }

      catch (NumberFormatException nfe)
      {
         System.out.println ("Invalid port: " + args [1]);
         System.out.println ("Usage: \n" +
            "\tjava ListQueueDepthNoAgent queue-manager\n" +
            "\tjava ListQueueDepthNoAgent host port channel");
      }

      catch (MQException mqe)
      {
         if (mqe.reasonCode != MQException.MQRC_NO_MSG_AVAILABLE)
         {
            System.err.println (mqe);
            mqe.printStackTrace();
         }
      }

      catch (IOException ioe)
      {
         System.err.println (ioe);
      }
   }
}



Any help will be greatly appreciated.

-pavan
Back to top
View user's profile Send private message
pavan-mq
PostPosted: Fri Jan 28, 2011 5:34 am    Post subject: Reply with quote

Novice

Joined: 03 Feb 2010
Posts: 13

Hi Jeff,

You are right.., The problem is the MQCCSID is not setting properly in my code.

After some google., i found this
Quote:
To request that the Queue Manager which converts the message to a codepage which the JVM can work with, simply set this variable on
the MQMessage object before doing the GET call:

// Request that the message is returned in Chinese:
msg.characterSet = 1381;
queue.get(msg, gmo);


For reference check this url : https://www-304.ibm.com/support/docview.wss?uid=swg1IZ60293

This fixed the issue. But still I didn't find a way to solve this using PCFMessageAgent.

Thanks for All your guidance to solve this using message.write(). You are all doing a great job here

-pavan
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » General IBM MQ Support » Getting Channel details from QM running with CCSID 1381
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.