Hi Team,

Thanks for your suggestion.

As per your suggestion i have added MQClient::MQSeries in my script. After that when i have tried to execute the script, it didn’t connect to queue manager.

Even it is not giving the proper completioncode and reason code, it is giving garbage value instead of the proper code.

When i am printing below code, inside open Queuemanager function it is printing garbage value

<code>
      my $compCode = 0;
      my $Reason = 0;

      print "Inside openqueuemgr \n";
      my $qm_name = "QM.A108020";
      print "Queue Manager is $qm_name \n";
      print "Santosh Inside connect\n";

      print "Printing completion code and reson before connect\n";
      $compCode = MQCC_FAILED;
      $Reason =   MQRC_UNEXPECTED_ERROR;
      my $mnone = MQRC_NONE;
      print "mqnone is $mnone\n";
      print "code is $compCode\n";
      print "Reason is  $Reason\n";
      print "Before calling MQCONN\n";
      print "-------------------------------------------\n";
<code end>

Output-
Printing completion code and reson before connect
mqnone is 4185249900
code is 12775184492
Reason is  9431638464620
Before calling MQCONN
-------------------------------------------
complition code is 8589934592
Reason is  8839042706432

Following is the my complete code-

Please let me know if i am doing anything wrong in the below script.


#!/usr/bin/perl -w
package Mqutils;
my $VERSION = '1.0';

use Carp;
use strict;
use English;
use strict;
#use MQSeries qw(:functions);
use MQClient::MQSeries qw(:constants);
use MQClient::MQSeries;
#use MQSeries::QueueManager;
#use MQSeries::Queue;
#use MQSeries::Message;

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 = "QM.A108020";
      print "Queue Manager is $qm_name \n";
      print "Santosh Inside connect\n";
      print "Printing completion code and reson before connect\n";
      $compCode = MQCC_FAILED;
      $Reason =   MQRC_UNEXPECTED_ERROR;
      my $mnone = MQRC_NONE;
      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) == MQCC_FAILED ) {
            print "Connection to Queuemanager failed\n";
            #return 1;
        } elsif ( $compCode == MQCC_WARNING ) {
            print "Connected the Queue Mager with Warning\n";
        } elsif ( $compCode == MQCC_OK ) {
            print "Connection sucessful with the queue manager\n";
        }
       else  {
            print "complition code is $compCode\n";
        }
if ( $Reason == MQRC_NONE ) {
            print "Connection to Queuemanager Fine\n";
            #return 1;
        } elsif ( $Reason == MQCC_WARNING ) {
            print "Connected the Queue Mager with Warning\n";
        #    return -1;
        } elsif ( $Reason == MQRC_UNEXPECTED_ERROR) {
            print "Unexpected error while connect to the queue manager\n";
        } elsif ( $self->{"Reason"} == MQRC_ENVIRONMENT_ERROR ) {
            print "environment error in  Queue Mager\n";
        #    return -1;
        } elsif ( $self->{"Reason"} == MQRC_MULTIPLE_REASONS) {
            print "hconn errorr\n";
        } elsif ( $self->{"Reason"} == MQRC_NOT_AUTHORIZED) {
            print "not authorize errorr\n";
        } elsif ( $self->{"Reason"} == MQRC_Q_MGR_NAME_ERROR) {
            print "Queue Manager errorr\n";
        }
        else {
            print "Reason is  $Reason\n";
            print "\n";
            }
print "After MQCONN\n";
}
1;

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

Thanks,
Santosh


________________________________________
From: perl-mqser...@morganstanley.com [perl-mqser...@morganstanley.com]
Sent: Wednesday, February 22, 2012 11:28 PM
To: Santosh Sadangi
Cc: perl-mqser...@morganstanley.com; modules@perl.org
Subject: Re: CPAN Mqseries Module for Solaris5.10

On Wed, Feb 22, 2012 at 10:46:35PM +0530, Santosh Sadangi wrote:
> Hi Team,
>
>
>
> Many Thanks for your reply.I am new to perl and mqseries.i am facing so many
> problem to connect to my local mqseries queue.
>
>
> 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.
>
>
>
> Step-1-Following is my Environment details
>
>
>
> SunOS 5.10 Generic_144488-09 sun4v sparc SUNW,SPARC-Enterprise-T5220
> MQseries version-6.0
> Perl 5.8

that sounds fine.

> Step-2-
>
>
>
> I have first used the object oriented approach.When i used that approach and
> wrote the script like below,i have got the below error.which i have specified
> 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()));
> #    };

if i run this code (having defined $qm_name to be relevant here), i
get just this output:

    After new and before connect

and that's it.

> 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,i am getting the junk comp code and reson code
> and it is not either connecting to queue manager or sending message to queue.

what exactly do you get?  i get this:

   Inside openqueuemgr
   Queue Manager is MQCRSH4
   Santosh Inside connect
   -------------------------------------------
   mqnone is 0
   code is 2
   Reason is  2195
   Before calling MQCONN
   -------------------------------------------
   Connection to Queuemanager failed
   Use of uninitialized value in numeric eq (==) at /ms/user/a/anbrown/rm.helpme line 82.
   Use of uninitialized value in numeric eq (==) at /ms/user/a/anbrown/rm.helpme line 82.
   Use of uninitialized value in numeric eq (==) at /ms/user/a/anbrown/rm.helpme line 82.
   Use of uninitialized value in numeric eq (==) at /ms/user/a/anbrown/rm.helpme line 82.
   Reason is  2058

   After MQCONN

but that's expected since the perl code is using MQServer::MQSeries
and not MQClient::MQSeries.  the former only works for talking to
locally installed qmgrs.  the latter can be used to talk to local or
remote qmgrs.  why don't you try changing that first.

> 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.

try using MQClient::MQSeries instead of MQServer::MQSeries.  also fix
those warnings about uninitialized values (hint: you are mixing up
$Reason and $self->{"Reason"}).

> Code:
[snip]
>
>
> 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.

it seemed to do so for me.  what output are you getting exactly?

> ________________________________________
> From: perl-mqser...@morganstanley.com [perl-mqser...@morganstanley.com]
> Sent: Wednesday, February 22, 2012 6:51 PM
> To: Santosh Sadangi
> Cc: modules@perl.org
> Subject: Re: CPAN Mqseries Module for Solaris5.10
>
> On Wed, Feb 22, 2012 at 11:59:55AM +0530, Santosh Sadangi wrote:
> > Hi Team,
> >
> > I am new to perl and Cpan Mqseries.I have written one script to connect to
> > local queuemanager by using perl.However it is not connecting to my
> > Queuemanager and the error code and completion code which i am getting is a
> > junk value.
> >
> > Upon investigation i have found from the following cpanmqseries web link
> > that,MQSeries1.32 is not supporting Solaris5.10 64bit platfoem.
> >
> > http://search.cpan.org/~mqseries/MQSeries-1.32/README
> >
> > So could you please let me know?which version of CPANMqseries is supporting
> for
> > Solaris5.10 64bit platform.
>
> they should all work on that platform, but you're not giving us much
> to go on here.  what completion and reason codes are you getting?  can
> you produce a small code sample that replicates the problem?
>

Reply via email to