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 Discussion » SVRCONN Channel Status

Post new topic  Reply to topic
 SVRCONN Channel Status « View previous topic :: View next topic » 
Author Message
jrjoe
PostPosted: Tue Mar 07, 2006 1:08 pm    Post subject: SVRCONN Channel Status Reply with quote

Acolyte

Joined: 20 Jan 2003
Posts: 60

I have a JAVA program that uses PCF commands to get the status of channels. It works fine but I can't fine how to display mulit SVRCONN connections.

For example if I do a "dis chs(SYSTEM.DEF.SVRCONN)" and there are 4 running I will see 4 differenet status.

With my PCF program I only get the first one back.


Thanks
Joe
Back to top
View user's profile Send private message
wschutz
PostPosted: Tue Mar 07, 2006 1:12 pm    Post subject: Reply with quote

Jedi Knight

Joined: 02 Jun 2005
Posts: 3316
Location: IBM (retired)

are you using the java / pcf supportpac? and what version / csd of MQ? ..... and for fun... what OS?
_________________
-wayne
Back to top
View user's profile Send private message Send e-mail AIM Address
jrjoe
PostPosted: Tue Mar 07, 2006 1:16 pm    Post subject: Reply with quote

Acolyte

Joined: 20 Jan 2003
Posts: 60

I am using my own java / pcf.

The version is MQ 5.3 CSD 7 and 8 on UNIX AIX(5.2) and SUN(5. platforms.
Back to top
View user's profile Send private message
wschutz
PostPosted: Tue Mar 07, 2006 3:56 pm    Post subject: Reply with quote

Jedi Knight

Joined: 02 Jun 2005
Posts: 3316
Location: IBM (retired)

jrjoe wrote:
I am using my own java / pcf.
You might want to look at the ms0b, here's a hack of one of the samples to do what you want:
Code:

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

public class wmsGetChStatus
{

                public static void main (String [] args)
        {
                PCFAgent                agent;
                PCFParameter []         parameters =
                                        {
                                                new MQCFST (CMQCFC.MQCACH_CHANNEL_NAME, "*"),
// This is the default, so it doesn't NEED to be specified:
                                                new  MQCFIN (CMQCFC.MQIACH_CHANNEL_INSTANCE_TYPE, CMQC.MQOT_CURRENT_CHANNEL)
 //                                             new MQCFIN (CMQCFC.MQIACH_CHANNEL_INSTANCE_TYPE, CMQC.MQOT_SAVED_CHANNEL)
                                        };
                MQMessage []            responses;
                MQCFH                   cfh;
                PCFParameter            p;
                String                  name = null;
                Integer                 iType = null;
                Integer                 mStatus = null;

                try
                {
                        // Connect a PCFAgent to the specified queue manager

                        if (args.length == 1)
                        {
                                System.out.print ("Connecting to local queue manager " +
                                        args [0] + "... ");
                                agent = new PCFAgent (args [0]);
                        }
                        else
                        {
                                System.out.print ("Connecting to queue manager at " +
                                        args [0] + ":" + args [1] + " over channel " + args [2] + "... ");
                                agent = new PCFAgent (args [0], Integer.parseInt (args [1]), args [2]);
                        }

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

                        // Use the agent to send the request

                        System.out.print ("Sending PCF request... ");
                        responses = agent.send (CMQCFC.MQCMD_INQUIRE_CHANNEL_STATUS, parameters);
                        for (int i = 0; i < responses.length; i++)
                        {
                                cfh = new MQCFH (responses [i]);

                                // Check the PCF header (MQCFH) in the response message

                                if (cfh.reason == 0)
                                {
                                        for (int j = 0; j < cfh.parameterCount; j++)
                                        {
                                                // Extract what we want from the returned attributes

                                                p = PCFParameter.nextParameter (responses [i]);

                                                switch (p.getParameter ())
                                                {
                                                case CMQCFC.MQCACH_CHANNEL_NAME:
                                                        name = (String) p.getValue ();
                                                        break;
                                                case CMQCFC.MQIACH_CHANNEL_INSTANCE_TYPE:
                                                        iType = (Integer) p.getValue ();
                                                        break;

                                                case CMQCFC.MQIACH_MCA_STATUS:
                                                        mStatus = (Integer) p.getValue ();
                                                        break;
                                                default:
                                                }
                                        }

                                        System.out.println ("Channel " + name + " Instance Type " + iType + " MCA Status " + mStatus);
                                }
                                else
                                {
                                        System.out.println ("PCF error:\n" + cfh);

                                        // Walk through the returned parameters describing the error

                                        for (int j = 0; j < cfh.parameterCount; j++)
                                        {
                                                System.out.println (PCFParameter.nextParameter (responses [0]));
                                        }
                                }
                                        }
                                }
                        }

                        // Disconnect

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

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

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

                catch (MQException mqe)
                {
                        System.err.println (mqe);
                }

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

and I've tested it and it works:

Quote:

[wschutz@wschutz ms0b]$ java wmsGetChStatus WSCHUTZ
Connecting to local queue manager WSCHUTZ... Connected.
Sending PCF request... Received reply.
Channel TO.CLUS1 Instance Type 1011 MCA Status 0
Channel WSCHUTZ.TEST.SVR Instance Type 1011 MCA Status 0
Channel EXIT.SVRCONN Instance Type 1011 MCA Status 3
Channel EXIT.SVRCONN Instance Type 1011 MCA Status 3
Channel EXIT.SVRCONN Instance Type 1011 MCA Status 3
Channel EXIT.SVRCONN Instance Type 1011 MCA Status 3
Disconnecting... Done.

_________________
-wayne
Back to top
View user's profile Send private message Send e-mail AIM Address
jrjoe
PostPosted: Tue Mar 07, 2006 9:25 pm    Post subject: Reply with quote

Acolyte

Joined: 20 Jan 2003
Posts: 60

Thanks Wayne that is just what I was looking for. I have not tested it yet but I should be able to use this in my code. I will let you know.

Thanks again ...
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 Discussion » SVRCONN Channel Status
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.