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 » IBM MQ Java / JMS » Problem Executing PCF Command using MQ Client

Post new topic  Reply to topic
 Problem Executing PCF Command using MQ Client « View previous topic :: View next topic » 
Author Message
jigjim
PostPosted: Mon Apr 05, 2004 1:52 pm    Post subject: Problem Executing PCF Command using MQ Client Reply with quote

Apprentice

Joined: 30 Mar 2004
Posts: 41

Hi Following is the code i use to execute a PCF Command using MQ Client Connection:

Code:
import java.io.*;
import com.ibm.mq.*;
import com.ibm.mq.pcf.*;


public class PCFClient_Trial {
   public static void main (String [] args) {
      MQQueueManager qmanager;
      String name = null;
      Integer depth = null;
      
      int [] attrs = { CMQC.MQCA_Q_NAME, CMQC.MQIA_CURRENT_Q_DEPTH };
      MQCFH cfh;
      PCFParameter p;

      
      System.out.print ("Connecting to queue manager at " +
         args [0] + ":" + args [1] + " over channel " +
         args [2] + "... ");
      MQEnvironment.hostname = args [0];      
      MQEnvironment.port = Integer.parseInt (args [1]);
      MQEnvironment.channel = args [2];
      
      MQEnvironment.properties.put(MQC.TRANSPORT_PROPERTY,
                              MQC.TRANSPORT_MQSERIES);
      System.out.println("Testing 1");
      
      try {
         qmanager = new MQQueueManager ("");
         System.out.println ("Connected.");
      
         int openOptions = MQC.MQOO_INPUT_AS_Q_DEF | MQC.MQOO_OUTPUT;
         
         MQQueue sys_def_local_q = qmanager.accessQueue(
            "SYSTEM.DEFAULT.LOCAL.QUEUE",openOptions,null,null,null);               
         
         MQMessage message = new MQMessage();
         // hello_world.writeUTF("Hello World!");      

         message.messageType = MQC.MQMT_REQUEST;
         message.expiry = 100;
         message.feedback = MQC.MQFB_NONE;
         message.format = MQC.MQFMT_ADMIN;

         MQPutMessageOptions pmo = new MQPutMessageOptions ();
         
         MQCFH.write (message, CMQCFC.MQCMD_INQUIRE_Q, 3);   // 3 parameters follow
         MQCFST.write (message, CMQC.MQCA_Q_NAME, "*");
         MQCFIN.write (message, CMQC.MQIA_Q_TYPE, CMQC.MQQT_ALL);
         MQCFIL.write (message, CMQCFC.MQIACF_Q_ATTRS, attrs);

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

         MQMessage retrievedMessage = new MQMessage();
                  
         MQGetMessageOptions gmo = new MQGetMessageOptions ();
         gmo.options = MQC.MQGMO_WAIT | MQC.MQGMO_CONVERT;
         gmo.waitInterval = 100;
         
         do {
            retrievedMessage.messageId = message.messageId;
            sys_def_local_q.get(retrievedMessage, gmo);
            cfh = new MQCFH (retrievedMessage);

            // 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;
                     default:
                  }
               }
               System.out.println ("Queue " + name + " curdepth " + depth);
            }
            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);

         sys_def_local_q.close();
         
         qmanager.disconnect();
      }   
      catch (MQException mqe) {
         if (mqe.reasonCode != MQException.MQRC_NO_MSG_AVAILABLE) {
            System.err.println (mqe);
         }
      }
      catch (IOException ioe) {
         System.err.println (ioe);
      }
   }
}


Following are the runtime parameters:

161.128.93.13 1414 SYSTEM.DEF.SVRCONN

and Following is the Error thorwn:

RUNNING IN NOOOOOOO PCF AGENT MODE
Connecting to queue manager at 161.128.93.13:1414 over channel SYSTEM.DEF.SVRCONN... Testing 1
Connected.
Sending PCF request... Unable to load message catalog - mqji
com.ibm.mq.MQException: Message catalog not found

Can Somebody Please help me with this

Thx.
Back to top
View user's profile Send private message
vennela
PostPosted: Mon Apr 05, 2004 2:10 pm    Post subject: Reply with quote

Jedi Knight

Joined: 11 Aug 2002
Posts: 4055
Location: Hyderabad, India

In your catch block, try to print out the reason code

Code:


        catch(MQException mqe){
            System.out.println("MQ Error - Reason code :" + mqe.reasonCode);
        }
Back to top
View user's profile Send private message Send e-mail Visit poster's website
EddieA
PostPosted: Mon Apr 05, 2004 2:20 pm    Post subject: Reply with quote

Jedi

Joined: 28 Jun 2001
Posts: 2453
Location: Los Angeles

And adding <Install_Dir>/lib to the CLASSPATH with get rid of the "Unable to load message catalog" error.

Cheers,
_________________
Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0
Back to top
View user's profile Send private message
jigjim
PostPosted: Tue Apr 06, 2004 6:41 am    Post subject: Reply with quote

Apprentice

Joined: 30 Mar 2004
Posts: 41

Hi,

when I send the message on COmmand Q it works fine. No catalog errors.

Its only when I try to send a PCF command on the command Q that it throws the catalog error and also the "Reply to Q name" not available.

What should the reply to Q name be when i try to execute PCF command on the command Q. Can it be any Q associated with any Q mgr?

I am using Websphere and Standalone Java application Classes. Could somebody let me know how I can do the Classpath settigns (Add the <Install_dir>/lib folder when I am not running the application in any specific server but just by using the "run" option from the toolbar.

Thanks

jigs
Back to top
View user's profile Send private message
bower5932
PostPosted: Tue Apr 06, 2004 9:21 am    Post subject: Reply with quote

Jedi Knight

Joined: 27 Aug 2001
Posts: 3023
Location: Dallas, TX, USA

The reply queue could be anything. However, I would think that you would want to specify a queue that you will be using to pick up the results of the PCF command.
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » Problem Executing PCF Command using MQ Client
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.