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 » Inquiring Channel results in RC 3047

Post new topic  Reply to topic
 Inquiring Channel results in RC 3047 « View previous topic :: View next topic » 
Author Message
kordi
PostPosted: Sun May 18, 2014 6:26 am    Post subject: Inquiring Channel results in RC 3047 Reply with quote

Centurion

Joined: 28 May 2012
Posts: 145
Location: PL

Can someone advise me what am I doing wrong in following code that I get RC3047?

Code:

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

public class mqCheck {

   public static void main (String [] args) {
      //PCFMessageAgent agent;
      PCFMessage request;
      PCFMessage[] responses;
      PCFMessageAgent agent = new PCFMessageAgent();
      
      request = new PCFMessage(CMQCFC.MQCMD_INQUIRE_CHANNEL);
      request.addParameter (CMQCFC.MQCACH_CHANNEL_NAME, "*");
      
      int[] attrs = {CMQCFC.MQCACH_DESC,CMQCFC.MQCACH_MCA_USER_ID,CMQCFC.MQCACH_CHANNEL_NAME,CMQCFC.MQIACH_CHANNEL_STATUS};      

      request.addParameter(CMQCFC.MQIACH_CHANNEL_INSTANCE_ATTRS, attrs);
      try {

         agent.connect("192.168.1.153", 1414, "MQADMIN.MO71.SVRCONN");
       System.out.println("Połaczono");
      }
     catch (MQException ex) {
      System.out.println("A WebSphere MQ Error occured : Completion Code " + ex.completionCode
          + " Reason Code " + ex.reasonCode);
      ex.printStackTrace();
      for (Throwable t = ex.getCause(); t != null; t = t.getCause()) {
        System.out.println("... Caused by ");
        t.printStackTrace();
      }
   }
   
   
   try {
         // send the request and collect the responses
         responses = agent.send(request);
         for (int i = 0; i < responses.length; i++) {
            //  get the channel name and trim the spaces
            String temp = responses[i].getStringParameterValue(CMQCFC.MQCACH_CHANNEL_NAME);
            String channelName = temp.trim();           
         
         //  get the channel description and trim the spaces
            temp = responses[i].getStringParameterValue(CMQCFC.MQCACH_DESC);
            String description = temp.trim();
         
         
            //  get the channel MCAUSER
            temp = responses[i].getStringParameterValue(CMQCFC.MQCACH_MCA_USER_ID);
            String mcauser = temp.trim();

            //  get the channel status
            int chlStatus = responses[i].getIntParameterValue(CMQCFC.MQIACH_CHANNEL_STATUS);

            System.out.println("chl: " + channelName + " status: " + chlStatus + "MCAUSER(" +  mcauser + ")" + "DESC(" + description + ")");
         }
      }
      catch (PCFException pcfEx)
      {
         System.out.println("A WebSphere PCF Error occured : Completion Code " + pcfEx.completionCode
          + " Reason Code " + pcfEx.reasonCode);
        pcfEx.printStackTrace();
      } catch (MQException ex) {
      System.out.println("A WebSphere MQ Error occured : Completion Code " + ex.completionCode
          + " Reason Code " + ex.reasonCode);
      ex.printStackTrace();
      for (Throwable t = ex.getCause(); t != null; t = t.getCause()) {
        System.out.println("... Caused by ");
        t.printStackTrace();
      }
   }
      catch (Exception e)
      {
         e.printStackTrace();
      }
   
      try {
        agent.disconnect();
      System.out.println("Rozłaczono");
      }
      catch (MQException e) {
        // We'll silently ignore it in this demonstration program
      }
   }
}
Back to top
View user's profile Send private message
hughson
PostPosted: Tue May 20, 2014 7:17 am    Post subject: Reply with quote

Padawan

Joined: 09 May 2013
Posts: 1914
Location: Bay of Plenty, New Zealand

3047 means MQRCCF_CFIL_PARM_ID_ERROR which means that you have an invalid parameter somewhere in a list. I suspect if you look at the rest of the information in the PCF response message that gave you that error it may also tell you the PARM_ID that was in ERROR.

However, without that information, and just guessing, I suspect you'll find that CMQCFC.MQIACH_CHANNEL_STATUS is not something you can inquire on CMQCFC.MQCMD_INQUIRE_CHANNEL. That parameter ID would be used on an MQCMND_INQUIRE_CHANNEL_STATUS command instead.

Cheers
Morag
_________________
Morag Hughson @MoragHughson
IBM MQ Technical Education Specialist
Get your IBM MQ training here!
MQGem Software
Back to top
View user's profile Send private message Visit poster's website
kordi
PostPosted: Tue May 20, 2014 1:02 pm    Post subject: Reply with quote

Centurion

Joined: 28 May 2012
Posts: 145
Location: PL

Hi Morag,

Thanks for your reply, but I tried changing attrs list already leaving only CMQCFC.MQCACH_CHANNEL_NAME, but it didn't change anything, I still receive RC 3047 :/
Back to top
View user's profile Send private message
hughson
PostPosted: Wed May 21, 2014 12:32 am    Post subject: Reply with quote

Padawan

Joined: 09 May 2013
Posts: 1914
Location: Bay of Plenty, New Zealand

Better look at the complete PCF response then and see what the queue manager thinks is the bad PARM_ID. Can you provide a browse of the reply message content perhaps so we can look at it?

Cheers
Morag
_________________
Morag Hughson @MoragHughson
IBM MQ Technical Education Specialist
Get your IBM MQ training here!
MQGem Software
Back to top
View user's profile Send private message Visit poster's website
kordi
PostPosted: Wed May 21, 2014 1:50 am    Post subject: Reply with quote

Centurion

Joined: 28 May 2012
Posts: 145
Location: PL

Oh, sure, where can I find this PCF reply message?
Back to top
View user's profile Send private message
hughson
PostPosted: Wed May 21, 2014 2:52 am    Post subject: Reply with quote

Padawan

Joined: 09 May 2013
Posts: 1914
Location: Bay of Plenty, New Zealand

It's the message you are printing out the 3047 from.

You seem to have exception handling in there which you haven't showed us the output from - perhaps that contains what we need?

Cheers
Morag
_________________
Morag Hughson @MoragHughson
IBM MQ Technical Education Specialist
Get your IBM MQ training here!
MQGem Software
Back to top
View user's profile Send private message Visit poster's website
kordi
PostPosted: Wed May 21, 2014 11:26 am    Post subject: Reply with quote

Centurion

Joined: 28 May 2012
Posts: 145
Location: PL

Here is my entire output generated by code above

MQJE001: Kod zakończenia: 2. Przyczyna: 3047.
A WebSphere PCF Error occured : Completion Code 2 Reason Code 3047
com.ibm.mq.pcf.PCFException: MQJE001: Kod zako˝czenia: 2. Przyczyna: 3047.
at com.ibm.mq.pcf.PCFMessageAgent.send(PCFMessageAgent.java:242)
at mqCheck.main(mqCheck.java:42)
Rozłaczono
Back to top
View user's profile Send private message
RogerLacroix
PostPosted: Wed May 21, 2014 3:06 pm    Post subject: Reply with quote

Jedi Knight

Joined: 15 May 2001
Posts: 3253
Location: London, ON Canada

Hi,

Did you try our friend Mr. Google?

First off, you need a type, here is a simple setup:
Code:
request.addParameter (CMQCFC.MQCACH_CHANNEL_NAME, "*");
request.addParameter (CMQCFC.MQIACH_CHANNEL_TYPE, CMQXC.MQCHT_ALL );
request.addParameter (CMQCFC.MQIACF_CHANNEL_ATTRS, new int [] {CMQCFC.MQIACF_ALL} );

Regards,
Roger Lacroix
Capitalware Inc.
_________________
Capitalware: Transforming tomorrow into today.
Connected to MQ!
Twitter
Back to top
View user's profile Send private message Visit poster's website
kordi
PostPosted: Thu May 22, 2014 1:53 pm    Post subject: Reply with quote

Centurion

Joined: 28 May 2012
Posts: 145
Location: PL

Hi,

Yes sir. For several hours I was looking for working example but everything what I found was not working :/

Thanks a lot for your reply. My code is working now

I don't like the documentation for MQ API. It doesn't show relationship between arguments, for example:

Code:
request.addParameter (CMQCFC.MQIACH_CHANNEL_TYPE, CMQXC.MQCHT_ALL );


There is no information that CMQCFC.MQIACH_CHANNEL_TYPE can have CMQXC.MQCHT_ALL attribute. Or maybe I read it wrong :/

Next step is to display channel status. I assume I cannot do that within CMQCFC.MQCMD_INQUIRE_CHANNEL and I will have to use CMQCFC.MQCMD_INQUIRE_CHANNEL_STATUS for that for every channel from a list.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Thu May 22, 2014 3:41 pm    Post subject: Reply with quote

Grand High Poobah

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

You can use wildcard names for channel status too.
Just don't be surprised if some channels do not return a status. They are in "inactive" status and are fine.

Have fun
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
hughson
PostPosted: Fri May 23, 2014 6:03 am    Post subject: Reply with quote

Padawan

Joined: 09 May 2013
Posts: 1914
Location: Bay of Plenty, New Zealand

kordi wrote:
I don't like the documentation for MQ API. It doesn't show relationship between arguments. There is no information that CMQCFC.MQIACH_CHANNEL_TYPE can have CMQXC.MQCHT_ALL attribute.


You can see the values that are expected here

where it shows:-

ChannelType (MQCFIN)
Channel type (parameter identifier: MQIACH_CHANNEL_TYPE).

If this parameter is present, eligible channels are limited to the specified type. Any attribute selector specified in the ChannelAttrs list which is only valid for channels of a different type or types is ignored; no error is raised.

If this parameter is not present (or if MQCHT_ALL is specified), channels of all types are eligible. Each attribute specified must be a valid channel attribute selector (that is, it must be one from the following list), but it might not be applicable to all (or any) of the channels returned. Channel attribute selectors that are valid but not applicable to the channel are ignored, no error messages occur, and no attribute is returned.
The value can be:

MQCHT_SENDER
Sender.
MQCHT_SERVER
Server.
MQCHT_RECEIVER
Receiver.
MQCHT_REQUESTER
Requester.
MQCHT_SVRCONN
Server-connection (for use by clients).
MQCHT_CLNTCONN
Client connection.
MQCHT_CLUSRCVR
Cluster-receiver.
MQCHT_CLUSSDR
Cluster-sender.
MQCHT_MQTT
Telemetry channel.
MQCHT_ALL
All types.

The default value if this parameter is not specified is MQCHT_ALL.
_________________
Morag Hughson @MoragHughson
IBM MQ Technical Education Specialist
Get your IBM MQ training here!
MQGem Software
Back to top
View user's profile Send private message Visit poster's website
kordi
PostPosted: Sat May 24, 2014 4:05 am    Post subject: Reply with quote

Centurion

Joined: 28 May 2012
Posts: 145
Location: PL

Thanks a lot for your feedback.

I use docs delivered with MQ client and this is a nightmare for me.

Morag, can you please give me a full link to online MQ API?

Thanks once again!

Cheers
Kordian
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Sat May 24, 2014 9:33 am    Post subject: Reply with quote

Grand High Poobah

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

Have you looked here? http://pic.dhe.ibm.com/infocenter/wmqv7/v7r5/topic/com.ibm.mq.ref.adm.doc/q086860_.htm?resultof=%22%70%63%66%22%20
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
kordi
PostPosted: Sun May 25, 2014 4:20 am    Post subject: Reply with quote

Centurion

Joined: 28 May 2012
Posts: 145
Location: PL

Thanks!
Back to top
View user's profile Send private message
kordi
PostPosted: Sun May 25, 2014 11:31 am    Post subject: Reply with quote

Centurion

Joined: 28 May 2012
Posts: 145
Location: PL

Guys,

I moved one step forward with my tool, but what I dont understand now is why I get printed MQJE001 message everytime channel status is not found while this exception is handled by printing out "Channel status not found" in line 120 and I should not get any additional mesage for this exception.

Do you have idea why I get it?

Thanks a lot in advance!

Code:

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

public class mqCheck {

    public static void main(String[] args) {
        //PCFMessageAgent agent;
        PCFMessage request;
        PCFMessage[] responses;
        PCFMessageAgent agent = new PCFMessageAgent();

        request = new PCFMessage(CMQCFC.MQCMD_INQUIRE_CHANNEL);
        request.addParameter(CMQCFC.MQCACH_CHANNEL_NAME, "*");
        request.addParameter(CMQCFC.MQIACH_CHANNEL_TYPE, CMQXC.MQCHT_ALL);

        request.addParameter(CMQCFC.MQIACF_CHANNEL_ATTRS, new int[] {
            CMQCFC.MQIACF_ALL
        });
        try {
            //PCFMessageAgent agent = new PCFMessageAgent();
            agent.connect("192.168.1.153", 1414, "MQADMIN.MO71.SVRCONN");
            System.out.println("Połaczono");
        } catch (MQException ex) {
            System.out.println("A WebSphere MQ Error occured : Completion Code " + ex.completionCode + " Reason Code " + ex.reasonCode);
            ex.printStackTrace();
            for (Throwable t = ex.getCause(); t != null; t = t.getCause()) {
                System.out.println("... Caused by ");
                t.printStackTrace();
            }
        }


        try {
            // send the request and collect the responses
            responses = agent.send(request);
            for (int i = 0; i < responses.length; i++) {
                //  get the channel name and trim the spaces
                String temp = responses[i].getStringParameterValue(CMQCFC.MQCACH_CHANNEL_NAME);
                String channelName = temp.trim();

                //  get the channel description and trim the spaces
                temp = responses[i].getStringParameterValue(CMQCFC.MQCACH_DESC);
                String description = temp.trim();

                String checkStatus = checkChannelStatus(channelName, agent);

                System.out.println("chl: " + channelName + " STATUS: " + checkStatus + " DESC(" + description + ")");
            }
        } catch (PCFException pcfEx) {
            System.out.println("A WebSphere PCF Error occured : Completion Code " + pcfEx.completionCode + " Reason Code " + pcfEx.reasonCode);
            pcfEx.printStackTrace();
        } catch (MQException ex) {
            System.out.println("A WebSphere MQ Error occured : Completion Code " + ex.completionCode + " Reason Code " + ex.reasonCode);
            ex.printStackTrace();
            for (Throwable t = ex.getCause(); t != null; t = t.getCause()) {
                System.out.println("... Caused by ");
                t.printStackTrace();
            }
        } catch (Exception e) {
            System.out.println("exception");
            e.printStackTrace();
        }

        try {
            agent.disconnect();
            System.out.println("Rozłaczono");
        } catch (MQException e) {
            // We'll silently ignore it in this demonstration program
        }
    }

    private static String checkChannelStatus(String channelName, PCFMessageAgent agent) throws Exception {
        // set up the PCF agent
        PCFMessage request;
        PCFMessage[] responses;
        String chs = "";

        // build a request
        request = new PCFMessage(CMQCFC.MQCMD_INQUIRE_CHANNEL_STATUS);
        // add a parameter designating the name of the channel for which status is requested
        request.addParameter(CMQCFC.MQCACH_CHANNEL_NAME, channelName);
        // add a parameter designating the instance type (current) desired
        request.addParameter(CMQCFC.MQIACH_CHANNEL_INSTANCE_TYPE, CMQC.MQOT_CURRENT_CHANNEL);
        // add a parameter designating the attributes desired, but first...
        // ...build an array list of attributes desired
        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_CHANNEL_STATUS
        };
        // ...now add the parameter for these attributes
        request.addParameter(CMQCFC.MQIACH_CHANNEL_INSTANCE_ATTRS, attrs);
        System.out.println("lklklklk");
        try {

            // send the request and collect the responses
            responses = agent.send(request);
            for (int i = 0; i < responses.length; i++) {

                int chlStatus = responses[i].getIntParameterValue(CMQCFC.MQIACH_CHANNEL_STATUS);
                System.out.println("channel status: " + chlStatus);
                String[] chStatusText = {
                    "", "MQCHS_BINDING", "MQCHS_STARTING", "MQCHS_RUNNING",
                        "MQCHS_STOPPING", "MQCHS_RETRYING", "MQCHS_STOPPED", "MQCHS_REQUESTING", "MQCHS_PAUSED",
                        "", "", "", "", "MQCHS_INITIALIZING"
                };
                chs = chStatusText[chlStatus];

            }

        } catch (PCFException pcfEx) {
            switch (pcfEx.reasonCode) {
            case CMQCFC.MQRCCF_CHL_STATUS_NOT_FOUND:
                {
                    System.out.println("Channel status not found");
                    break;
                }
            default:
                System.out.println("PCF Exception NOT!! handled in ChannelStatus");
                throw pcfEx;
            }
        }
        return chs;
    }
}
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 » IBM MQ Java / JMS » Inquiring Channel results in RC 3047
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.