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 » MqseriesResoncode and Compcode issue

Post new topic  Reply to topic
 MqseriesResoncode and Compcode issue « View previous topic :: View next topic » 
Author Message
dhungu
PostPosted: Fri Feb 17, 2012 4:32 am    Post subject: MqseriesResoncode and Compcode issue Reply with quote

Novice

Joined: 17 Feb 2012
Posts: 14

Hi Team,

I am new to Mqseries and new to perl scripting.

I am writing one perl script to insert message into my local queue by using following Api.

1)MQCONN
2)MQPUT
3)MQOPEN
4)MQGET

When i am running the script it is not sending the message to local queue and giving some big Junk value in resoncode and complition code.

Which creating problem for me to identify exactly for which reson the script is failing,as mostof the Mqseries reson code and completion code is 4digit Number.In my case it is comming 10 digit.

So could you please suggest me,how can i need to use mqseries resoncode and compltion code in my script to get the proper resoncode and completion code insteadof junk value.

Following is my snapshot of the code and my output-

When i am executing the below code in my perl script,when i am printing the reson code and compltion code after and before exection of MQCONN function i am getting the below big number as output.which is after this code.


my $compCode = MQSeries::MQCC_FAILED;
my $Reason = MQSeries::MQRC_UNEXPECTED_ERROR;
my $mnone = MQSeries::MQRC_NONE;

print "-------------------------------------------\n";
print "mqnone is $mnone\n";
print "code is $compCode\n";
print "Reason is $Reason\n";
print "Before calling MQCONN\n";


print "-------------------------------------------\n";

$Hconn = MQCONN($qm_name,
$compCode,
$Reason,
)|| die "Unable to Connect to Queuemanager\n";



print "code is $compCode\n";
print "Reason is $Reason\n";

Output of the above code-

mqnone is 4185249900
code is 12775184492
Reason is 9431638464620
Before calling MQCONN


------------------------------------------------------------------------------------------------------
For testing purpose i tried this below code in my perl script.

my $mqnone = MQSeries:: MQRC_NONE

In Mq the value of the Macro MQRC_NONE is zero.When i have tried to print this,it print a bignumber like below,instead of printing the number Zero.

mqnone is 4185249900

Please anyone help me in this,as i am stuck inthis issue from quite long time.

Thanks in Advance,
Santosh
Back to top
View user's profile Send private message
mqjeff
PostPosted: Fri Feb 17, 2012 5:20 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

So you would typically do this in perl using the MQSeries::MQQueue and MQSeries::MQQueueManager object oriented modules, because they're simpler...

But when I run your code locally, I get
Code:
-------------------------------------------
mqnone is 0
code is 2
Reason is 2195
Before calling MQCONN
-------------------------------------------
code is 0
Reason is 0


So it's able to connect just fine for me.

Do you have
Code:
use MQSeries.pl;
at the start of your perl file?

Did you experience any issues while trying to install the modules?

Are you, somehow, trying to use this code on a machine that doesn't have MQ installed on it?
Back to top
View user's profile Send private message
dhungu
PostPosted: Fri Feb 17, 2012 10:50 am    Post subject: Re: MqseriesResoncode and Compcode issue Reply with quote

Novice

Joined: 17 Feb 2012
Posts: 14

Hi Mqjeff,

Many Thanks for your quick reply.

Sorry for such a big below mail.I am writing this mail,as you can understand my problem clearly ,which would help me to resolve the issue.

1)Mqseries is installed in my machine,as i am ableto run the command mqsc and amqget ,amqput to put message and get message by mqcommand.

2)I have first used the approach which you told.That is to use Object model.

When i used that approach and wrote the script like below,i have got the below error.which i have specifying below.

-------------------------------------------------------------

Code:
-Mandatory parameter 'AutoConnect' missing in call to MQSeries::QueueManager::Connect
        MQSeries::QueueManager::Connect('MQSeries::QueueManager=HASH(0x7ae7ec)') called at Mqutils.pm line 63
        Mqutils::openQueueMgr('Mqutils=HASH(0x32590)', 'QM.A108020', 10.225.98.86, 1414, 'QM.A108020', 'request') called at ./mq_put.pl line 25
-------------------------------------------------------------------------------------


Following is the snap shot of my perl script code.if you look the below code the argument AutoConnect is already present inside Queuemanager::new in the last row.inspite of that when i am using the object,which is create by Quemanger constructer to call connect() api,it is giving the error,which i have specified above.

Code:
my $qm = MQSeries::QueueManager->new(
                              QueueManager         => $qm_name,
                              Carp                 => 0,
                              CompCode             => 0,
                              Reason               => 0,
                              GetConvert           => 0,
                              PutConvert           => 0,
                              RetryCount           => 0,
                              RetrySleep           => 0,
                              RetryReasons         => 0,
                              ConnectTimeout       => 0,
                              ConnectTimeoutSignal => 0,
                              ClientConn           => 0,
                              SSLConfig            => 0,
                              AutoConnect          => 0,
                              AutoCommit           => 0,
    )|| die "Unable to instantiate MQSeries::QueueManager object\n";
print "After new and before connect\n";
#  kick it off and see if it connects
#    eval {
        $qm->Connect()
            || die(sprintf("Connect failed with CompCode: %s",
                               "Reason %sn",$qm->CompCode(),$qm->Reason()));
#    };


Step-3-When i didnt suceed to resolve the above problem,I thought to use the MQAPI directly in my call,in the following way,which i am specifying below.When i am using the below script,which i have posted in my earliear post,i am getting the junk comp code and reson code and it is not either connecting to queue manager or sending message to queue.

So could you please help me how to resolve this problem,if it is a data conversion problem or anything wrong in my perl script.

Code:
#!/usr/bin/perl -w
package Mqutils;

my $VERSION = '1.0';


use Carp;
use English;

use strict;
use MQSeries qw(:functions);
use MQSeries qw(:constants);
use MQServer::MQSeries;
use MQSeries::QueueManager; 
use MQSeries::Queue; 
use MQSeries::Message;
use MQSeries::Message::Storable;


my $Hconn = "";
my $Hobj = 0;
my $MsgDesc = undef;
my $datalength = undef;
sub new() { # our constructor 

   my $invocant = shift; 
   my $class = ref($invocant) || $invocant; # Object or class name 
   my $self = {};       # initiate our handy hashref 
   bless($self,$class); # make it usable 
   return $self;
 } 




sub openQueueMgr() { # open the Queue Manager
      my $self = shift;
      my $compCode = 0;
      my $Reason = 0;
     
      print "Inside openqueuemgr \n";   
      my ($qm_name) = @_;   

      print "Queue Manager is $qm_name \n";
      print "Santosh Inside connect\n";
     
      $compCode = MQSeries::MQCC_FAILED;
      $Reason =   MQSeries::MQRC_UNEXPECTED_ERROR;   
      my $mnone = MQSeries::MQRC_NONE;   

      print "-------------------------------------------\n";
        print "mqnone is $mnone\n";
   print "code is $compCode\n";
   print "Reason is  $Reason\n";
   print "Before calling MQCONN\n"; 
     
      print "-------------------------------------------\n";
            $Hconn = MQCONN($qm_name,
                             $compCode,
                             $Reason,
                            )|| die "Unable to Connect to Queuemanager\n";

 
if ( ($compCode) == MQSeries::MQCC_FAILED ) {
            print "Connection to Queuemanager failed\n";
            #return 1;
        } elsif ( $compCode == MQSeries::MQCC_WARNING ) {
            print "Connected the Queue Mager with Warning\n";
        } elsif ( $compCode == MQSeries::MQCC_OK ) {
            print "Connection sucessful with the queue manager\n";
        }
       else  {
            print "complition code is $compCode\n";
        }

if ( $Reason == MQSeries::MQRC_NONE ) {
            print "Connection to Queuemanager Fine\n";
            #return 1;
        } elsif ( $Reason == MQSeries::MQCC_WARNING ) {
            print "Connected the Queue Mager with Warning\n";
        #    return -1;
        } elsif ( $Reason == MQSeries::MQRC_UNEXPECTED_ERROR) {
            print "Unexpected error while connect to the queue manager\n";
        } elsif ( $self->{"Reason"} == MQSeries::MQRC_ENVIRONMENT_ERROR ) {
            print "environment error in  Queue Mager\n";
        #    return -1;
        } elsif ( $self->{"Reason"} == MQSeries::MQRC_MULTIPLE_REASONS) {
            print "hconn errorr\n";
        } elsif ( $self->{"Reason"} == MQSeries::MQRC_NOT_AUTHORIZED) {
            print "not authorize errorr\n";
   } elsif ( $self->{"Reason"} == MQSeries::MQRC_Q_MGR_NAME_ERROR) {
            print "Queue Manager errorr\n";
   }
        else {
       print "Reason is  $Reason\n";
            print "\n";
       }
print "After MQCONN\n";
}


Step-4-if you look above code,even the control is not comming to any of the resoncode and compcode,which i have specified in the above if else condition.


Please help me in this above issue.

Thanks,
Santosh

EDIT by exerk: code tags added to aid readability.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Fri Feb 17, 2012 11:02 am    Post subject: Re: MqseriesResoncode and Compcode issue Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

Please use [ c o d e ] tags around code.

Please try
Code:
my $qm = MQSeries::QueueManager->new(
                              QueueManager         => $qm_name,
     AutoConnect  => 0,
    ) || die "Unable to instantiate MQSeries::QueueManager object\n";

  $qmgr->Connect() ||
    die("Unable to connect to queue manager\n" .
        "CompCode => " . $qmgr->CompCode() . "\n" .
        "Reason => " . $qmgr->Reason() .
        " (", MQReasonToText($qmgr->Reason()) . ")\n");


And then make sure the $qm_name is running on the same machine as your code.

You're trying too hard to write code, and are running ahead of yourself.

Get the basics down - get a single, simple, program that only connects to your local queue manager working.

Again, did the perl modules install correctly? What platform are you on?
Back to top
View user's profile Send private message
dhungu
PostPosted: Mon Feb 20, 2012 12:11 am    Post subject: Re: MqseriesResoncode and Compcode issue Reply with quote

Novice

Joined: 17 Feb 2012
Posts: 14

Hi Mqjeff,


Follwing is my platform information.

SunOS 5.10 Generic_144488-09 sun4v sparc SUNW,SPARC-Enterprise-T5220

I have tried to write the code as you specified above.When i have executed the script, i am getting below error.As if you look your Queuemanager.pm file inside the constructer sub new(),it is doing the validation.thats why i am getting the below error.Please let me know if you have any suggestion to resolve this error.

Code:


Mandatory parameters 'ConnectTimeoutSignal', 'ClientConn', 'RetryCount', 'Carp', 'Reason', 'SSLConfig', 'CompCode', 'RetryReasons', 'GetConvert', 'RetrySleep' missing in call to MQSeries::QueueManager::new
        MQSeries::QueueManager::new('undef', 'QueueManager', 'Mqutils=HASH(0x32590)', 'AutoConnect', 0) called at Mqutils.pm line 37
        Mqutils::openQueueMgr('Mqutils=HASH(0x32590)', 'QM.A108020')



Thanks,
santosh

EDIT by exerk: please use the quick-buttons not html tags to enclose text, you'll also see the construction of the tags the quick-buttons produce.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Mon Feb 20, 2012 3:31 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

Okay, that's because you have use strict.
Back to top
View user's profile Send private message
dhungu
PostPosted: Mon Feb 20, 2012 8:13 am    Post subject: Reply with quote

Novice

Joined: 17 Feb 2012
Posts: 14

Hi Mqjeff,

Thanks for your reply and help.

I will disable strict and try again tommrow.

If i will disable stric or comment strict,will it not create any problem in my program.

Actualy i am new to Perl,that why asking this,so please dont mind.

Thanks,
Santosh
Back to top
View user's profile Send private message
dhungu
PostPosted: Tue Feb 21, 2012 5:21 am    Post subject: Reply with quote

Novice

Joined: 17 Feb 2012
Posts: 14

Hi Mqjeff,

As per your suggestion i have change my script and executed, now i am not getting any error.However i am not able to connect to my local queue manager.

I am getting the compltion code as 19 and reson code as 11264.and still i am getting the garbage vale,when i am trying to print the below code,which is present in MQSeries::Queuemanager.pm.

Code:
$self->{"CompCode"} = MQSeries::MQCC_FAILED;
    $self->{"Reason"} = MQSeries::MQRC_UNEXPECTED_ERROR;
    my $retrycount = 0;
    print "-------------------\n";
    print $self->{"CompCode"};
    print "\n";


I am thinking as the above code not getting the value of the constants MQSeries::MQCC_FAILED,it is giving garbage value.

So could you please let me know,in your environment which file the value of the constant MQSeries::MQCC_FAILED is defined.and how you are printing this to get the proper value.

Please help me how can i proceed to investigate this issue.

Many Thanks to you the help i got from you as of now.

Folling is my environment details-

Name: WebSphere MQ
Version: 6.0.2.7
CMVC level: p600-207-090629
BuildType: IKAP - (Production)

Operating system-SunOS 5.10 Generic_144488-09 sun4v sparc SUNW,SPARC-Enterprise-T5220

Thanks,
Santosh

EDIT by exerk: Edited again to put square [] brackets around code tags!
Back to top
View user's profile Send private message
mqjeff
PostPosted: Tue Feb 21, 2012 5:46 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

Hi Santosh -
Did you have any errors when you installed the perl modules?

The constant in question is defined originally in the MQ header files that are installed with MQ, but it should also be redefined or at least linked from the perl module files.

So if you are having issues with the resolution of these constants, it at least suggests that something is wrong with the installation of the modules.

Also, since you are on Unix, you will be able to get better support from the maintainers of the perl modules. I'm not saying I won't help, but I'm suggesting they might have a faster answer for some things. They also might not.


But they don't use Windows themselves, so they tend not to be much assistance with windows issues.
Back to top
View user's profile Send private message
dhungu
PostPosted: Tue Feb 21, 2012 9:06 am    Post subject: Reply with quote

Novice

Joined: 17 Feb 2012
Posts: 14

Hi mqjeff,

The module was installed already .How to check the module is installed properly or not.

If i need to install again then,is it require root acces ? or i can install in my home directory.

Thanks,
Santosh
Back to top
View user's profile Send private message
mqjeff
PostPosted: Tue Feb 21, 2012 9:13 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

presumably the person who installed it wouldn't have left it with a bad install.

But yes, you can use CPAN or CPAN+ to install any modules you want into a personal site repository, for example in your home directory.

You need a C compiler to install the MQSeries modules. This is easier on unix than on Windows.

Again, I'd approach the team supporting the modules on this whole area. They should be able to provide some assistance in determining if it's installed correctly and with creating a home directory install.

Send them an email to the address listed in the perldoc.
Back to top
View user's profile Send private message
dhungu
PostPosted: Tue Feb 21, 2012 10:16 am    Post subject: Reply with quote

Novice

Joined: 17 Feb 2012
Posts: 14

Hi mqjeff,

I have checked in the below link,for sun solaris 5.10(which is my solaris os),CPAN didnt build their mqseris module.

Pease let me know,if you have any information whether it is supported to sun os 5.10 or not,otherwise please advise me,to whom do i need to send mail to conform this.

This package has been known to build with the following combinations of software. Those marked with an asterix (*) are platforms the maintainers can not test personally, so there is a remote possibility that there may be new bugs in these platforms. Please report problems to the maintainers.

Operating System MQSeries Version Perl Version
================ ================ ============
SunOS 5.7 5.2 5.8
SunOS 5.7 5.3 Same as SunOS 5.7 / MQ 5.2
SunOS 5.8 5.2 Same as SunOS 5.7 / MQ 5.2
SunOS 5.8 5.3 Same as SunOS 5.7 / MQ 5.2
*SunOS 5.8 6.0 5.8
SunOS 5.9 5.3 Same as SunOS 5.7 / MQ 5.2
*SunOS 5.8 7.0 5.10
*AIX 5.1L 6.0 5.8

Thanks,
Santosh
Back to top
View user's profile Send private message
mqjeff
PostPosted: Tue Feb 21, 2012 10:20 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

The contact email is at the bottom of http://search.cpan.org/~mqseries/MQSeries-1.32/README in the section labeled 'AUTHORS'.

I don't have any additional info on the supported platforms.
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 » MqseriesResoncode and Compcode issue
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.