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 » Executing PCF Command using MQ Client

Post new topic  Reply to topic
 Executing PCF Command using MQ Client « View previous topic :: View next topic » 
Author Message
jigjim
PostPosted: Tue Apr 20, 2004 2:11 pm    Post subject: Executing PCF Command using MQ Client Reply with quote

Apprentice

Joined: 30 Mar 2004
Posts: 41

Hi,

I am using the below code to put a PCF Command on the Client. I am not able to see the message on any Q's on mainframe. The error log on mainframe shows the follwing lines:

Code:
17.42.28 STC00700  +CSQX208E &MQO1 CSQXRESP Error receiving data,  683
   683              channel SYSTEM.DEF.SVRCONN,
   683              connection 104.154.69.132
   683              (queue manager ????)
   683              TRPTYPE=TCP RC=00000461
17.42.28 STC00700  +CSQX599E &MQO1 CSQXRESP Channel SYSTEM.DEF.SVRCONN ended ab



Can somebody pls help me with this? Do I need set the Msg Charachter set so that the system Q understands the command and sends appropriate reply to the reply Q.

Thanks Jigs


Code:
public class PCFClient_Trial {
   public static void main (String [] args) {
      System.out.println("***  In PCFClient_Trial  ***");
      MQQueueManager qmgr;
      MQQueue sendQ, replyQ;
      MQPutMessageOptions pmo = new MQPutMessageOptions ();
      MQGetMessageOptions gmo = new MQGetMessageOptions ();    
      MQMessage sendM, recvM;
        String name = null;
        Integer depth = null;
      String replyQueueName = "MQO1LV5.QL.ICRS_TO_XRM";
       
       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);
        
        try {
         qmgr = new MQQueueManager ("MQO1");
          System.out.println ("Connected to: " + qmgr.name);
             
             String a = qmgr.getCommandInputQueueName();
             System.out.println("Command Q for MQO1 is : " + a);
             
             // MQC.MQOO_OUTPUT
             // MQC.MQOO_INPUT_AS_Q_DEF
      // MQC.MQOO_INPUT_SHARED
      // MQC.MQOO_INPUT_EXCLUSIVE
         
   int openOptions = MQC.MQOO_OUTPUT ;
         
             // SYSTEM.CLUSTER.COMMAND.QUEUE
             // SYSTEM.DEFAULT.LOCAL.QUEUE
             // SYSTEM.COMMAND.INPUT
          sendQ = qmgr.accessQueue(
            "SYSTEM.COMMAND.INPUT",openOptions,null,null,"");               
         
          sendM = new MQMessage();
          // message.writeUTF("Hello World!");       

         sendM.messageType = MQC.MQMT_REQUEST;
         sendM.characterSet = 37;
         // sendM.
         sendM.expiry = 100;
         sendM.feedback = MQC.MQFB_NONE;
         sendM.format = MQC.MQFMT_ADMIN;
         sendM.replyToQueueManagerName = "MQO1";
         sendM.replyToQueueName = replyQueueName;

           MQCFH.write (sendM, CMQCFC.MQCMD_INQUIRE_Q, 3);   // 3 parameters follow
          MQCFST.write (sendM, CMQC.MQCA_Q_NAME, "*");
          MQCFIN.write (sendM, CMQC.MQIA_Q_TYPE, CMQC.MQQT_ALL);
          MQCFIL.write (sendM, CMQCFC.MQIACF_Q_ATTRS, attrs);
               
          System.out.print ("Sending PCF request... ");
          sendQ.put(sendM, pmo);
          System.out.println ("Sent.");
Back to top
View user's profile Send private message
EddieA
PostPosted: Tue Apr 20, 2004 2:32 pm    Post subject: Reply with quote

Jedi

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

Based on the error part, that's z/OS you're trying to connect to. Guess what, z/OS doesn't support PCF messages.

Take a look at the PCF manual for how you "talk" to z/OS remotely. You send in "clear text" commands, and parse out "clear text" replies. Fun.

But, that's not you're problem. I'm not sure what is though. Do you have the CAF installed.

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
jefflowrey
PostPosted: Tue Apr 20, 2004 5:50 pm    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Yes, again, you can't use PCF messages against a Z/OS queue manager.

You have to put MQSC commands onto the command queue.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
jigjim
PostPosted: Wed Apr 21, 2004 7:53 am    Post subject: Reply with quote

Apprentice

Joined: 30 Mar 2004
Posts: 41

Hi,

I am investigating on how to send MQSC commands on z/os SYSTEM.COMMAND.INPUT Q.

Does anybody have sameple code in JAVA for the same. A sample code whic can be excuted is DISPLAY QMR

Thanks

Jignesh
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Wed Apr 21, 2004 8:00 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

There's nothing to investigate.

You put the MQSC command into the body of the message, and put it on the queue.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
jigjim
PostPosted: Wed Apr 21, 2004 9:30 am    Post subject: Reply with quote

Apprentice

Joined: 30 Mar 2004
Posts: 41

Hi,

Does the below code look correct? I am more of a java programmer then a MS Series guy and so am having difficulty in MQ stuff ..

Thanks

Jigs

Code:
public class MQSCClient {
   public static void main (String [] args) {
      MQQueueManager qmgr;
      MQQueue sendQ, replyQ;
      MQPutMessageOptions pmo = new MQPutMessageOptions ();
      MQGetMessageOptions gmo = new MQGetMessageOptions ();    
      MQMessage sendM, recvM;
      String replyQueueName = "MQO1LV5.QL.ICRS_TO_XRM";
       
                                        // Channel = SYSTEM.DEF.SVRCONN
        MQEnvironment.hostname = args [0];       
       MQEnvironment.port = Integer.parseInt (args [1]);
        MQEnvironment.channel = args [2];
       
        MQEnvironment.properties.put(MQC.TRANSPORT_PROPERTY, MQC.TRANSPORT_MQSERIES);
        
        try {
         qmgr = new MQQueueManager ("MQO1");
      int openOptions = MQC.MQOO_OUTPUT ;
         
                                        sendQ = qmgr.accessQueue("SYSTEM.COMMAND.INPUT",openOptions,null,null,"");               
         
       sendM = new MQMessage();
       sendM.writeUTF("DISPLAY QMGR");       

      sendM.messageType = MQC.MQMT_REQUEST;
      sendM.expiry = 100;
      sendM.feedback = MQC.MQFB_NONE;
      sendM.format = MQC.MQFMT_ADMIN;
      sendM.replyToQueueManagerName = "MQO1";
      sendM.replyToQueueName = replyQueueName;

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

      replyQ = qmgr.accessQueue (replyQueueName, MQC.MQOO_INPUT_EXCLUSIVE, "", "", "");
               
      gmo.options = MQC.MQGMO_WAIT | MQC.MQGMO_CONVERT ;
      gmo.waitInterval = 1000;
                       recvM = new MQMessage();
      recvM.messageId = sendM.messageId;
         
      replyQ.get(recvM, gmo); 
      String msgText = recvM.readUTF();
      System.out.println("The message is : "+msgText);
                       sendQ.close();
      replyQ.close();
      qmgr.disconnect();
     }   
     catch (MQException mqe) {
              if (mqe.reasonCode != MQException.MQRC_NO_MSG_AVAILABLE) {
            System.err.println (mqe);
          }
        }
        catch (IOException ioe) {
          System.err.println (ioe);
        }
   }
}
Back to top
View user's profile Send private message
victorf
PostPosted: Wed May 05, 2004 7:51 am    Post subject: MQ z/OS and java Reply with quote

Newbie

Joined: 05 May 2004
Posts: 1

Hi -

I have the same problem. Can you please post the code if you
have it working.

Regards,

Victor Fernandez

jigjim wrote:
Hi,

Does the below code look correct? I am more of a java programmer then a MS Series guy and so am having difficulty in MQ stuff ..

Thanks

Jigs

Code:
public class MQSCClient {
   public static void main (String [] args) {
      MQQueueManager qmgr;
      MQQueue sendQ, replyQ;
      MQPutMessageOptions pmo = new MQPutMessageOptions ();
      MQGetMessageOptions gmo = new MQGetMessageOptions ();    
      MQMessage sendM, recvM;
      String replyQueueName = "MQO1LV5.QL.ICRS_TO_XRM";
       
                                        // Channel = SYSTEM.DEF.SVRCONN
        MQEnvironment.hostname = args [0];       
       MQEnvironment.port = Integer.parseInt (args [1]);
        MQEnvironment.channel = args [2];
       
        MQEnvironment.properties.put(MQC.TRANSPORT_PROPERTY, MQC.TRANSPORT_MQSERIES);
        
        try {
         qmgr = new MQQueueManager ("MQO1");
      int openOptions = MQC.MQOO_OUTPUT ;
         
                                        sendQ = qmgr.accessQueue("SYSTEM.COMMAND.INPUT",openOptions,null,null,"");               
         
       sendM = new MQMessage();
       sendM.writeUTF("DISPLAY QMGR");       

      sendM.messageType = MQC.MQMT_REQUEST;
      sendM.expiry = 100;
      sendM.feedback = MQC.MQFB_NONE;
      sendM.format = MQC.MQFMT_ADMIN;
      sendM.replyToQueueManagerName = "MQO1";
      sendM.replyToQueueName = replyQueueName;

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

      replyQ = qmgr.accessQueue (replyQueueName, MQC.MQOO_INPUT_EXCLUSIVE, "", "", "");
               
      gmo.options = MQC.MQGMO_WAIT | MQC.MQGMO_CONVERT ;
      gmo.waitInterval = 1000;
                       recvM = new MQMessage();
      recvM.messageId = sendM.messageId;
         
      replyQ.get(recvM, gmo); 
      String msgText = recvM.readUTF();
      System.out.println("The message is : "+msgText);
                       sendQ.close();
      replyQ.close();
      qmgr.disconnect();
     }   
     catch (MQException mqe) {
              if (mqe.reasonCode != MQException.MQRC_NO_MSG_AVAILABLE) {
            System.err.println (mqe);
          }
        }
        catch (IOException ioe) {
          System.err.println (ioe);
        }
   }
}
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Thu May 06, 2004 11:11 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

From one of the different posts in the forum:
WriteUTF method puts additional stuff on the queue.
Check the other methods for writing text. Try using one of those.

Good luck
F.J.
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » 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.