Hi Team,
I have debug MQClient::MQSeries.pm file.When i have tried to print the Value of MQCC_FAILED,i got the garbage value also there.
So could you please help me in the following Query-
1)In my Solaris64bit environment,i am getting garbage value is it due that,MQseries1.27 is not supporting to 64bit plat form.
2)If it is supporting then from which file it is loading the value of the constant MQCC_FAILED inside MQSries.pm file.
3)The garbage value is comming is it dueto the MQSeries installation problem.Should i install again to fix this?
In My solaris environment MQClient::MQSeries.pm file is defined in the following way.
BEGIN {
%EXPORT_TAGS =
( 'functions' => [ qw(
MQCONN
MQCONNX
)
],
'constants' => [ qw(
MQRC_NONE
MQACH_CURRENT_VERSION
MQCC_FAILED
)
]
);
#
# Build 'all' list and make routines known in @EXPORT
#
$EXPORT_TAGS{'all'} = [ map { @$_ } values %EXPORT_TAGS ];
Exporter::export_tags('all');
}
Thanks,
Santosh
________________________________________
From: Santosh Sadangi
Sent: Thursday, March 01, 2012 9:18 AM
To: perl-mqser...@morganstanley.com; modules@perl.org
Subject: FW: CPAN Mqseries Module for Solaris5.10
Hi Team,
Many thanks for your help and suggestion. I am new to Perl and more interested to work in this in my future. I am struggling for this issue from quite long time and not able to find any solution to work by using Perl.
Please guide me to resolve this issue.
Problem section-1-
I have executed following statement in my UNIX box. When I executed I got the following error.
santosh_script> perl -e 'use MQSeries; print(MQSeries::MQRC_UNEXPECTED_ERROR, "\n");'
Can't locate MQSeries.pm in @INC (@INC contains: /usr/perl5/5.8.4/lib/sun4-solaris-64int /usr/perl5/5.8.4/lib /usr/perl5/site_perl/5.8.4/sun4-solaris-64int /usr/perl5/site_perl/5.8.4 /usr/perl5/site_perl /usr/perl5/vendor_perl/5.8.4/sun4-solaris-64int /usr/perl5/vendor_perl/5.8.4
/usr/perl5/vendor_perl .) at -e line 1.
BEGIN failed--compilation aborted at -e line 1.
To resolve this I have tried following things but nothing workout for me.
1) The above error is coming, as MQseries.pm file is not present at @INC.
2) When I have added the path of my MQSeries.pm file in my PATH and executed the statement, I got the error same as above.
3) Finally I have tried to add in INC,by using following command. When I am executing this, it not adding and taking more time and no shell prompt is coming for long time.
Perl –I /applications/hotscan/HSDOM/hotdev2/Learning/santosh_script/Mqlib/sun4-solaris
So could you please let me know to add this path in PERL INC, Do I need?supper user access.
Problem Section-2-
Following is my Analysis regarding the garbage value issue. Please correct me and provide your suggestion, if I have analyzed anything wrong.
I am getting the garbage value in MQSeries constant and my MQCONN is not able to connect to Queue manager due to following reason.
1) MQCC_FAILED and other MQSeries constant is declared in the file MQClient/MQSeries.pm.From this file it is autolodaing this constant at runtime by the function autoload.
BEGIN {
%EXPORT_TAGS =
( 'functions' => [ qw(
MQCONN
MQCONNX
)
],
'constants' => [ qw(
MQRC_NONE
MQACH_CURRENT_VERSION
MQCC_FAILED
)
]
);
#
# Build 'all' list and make routines known in @EXPORT
#
$EXPORT_TAGS{'all'} = [ map { @$_ } values %EXPORT_TAGS ];
Exporter::export_tags('all');
}
2) So I am thinking,as the Autoload function is not ableto load these constant,I am getting the garbage value.
3) I have conformed this,when I added the below statement in MQSeries.pm file to print the Constat MQCC_FAILED like this.I got the NULL Value in my output.
Print(MQCC_FAILED);
4) When I have searched this constant in my sever,I found this is declared in the below file .
/usr/include/cmqc.h: #define MQRC_NONE 0
5) So could you please let me know?in your environment, where the mqseries constant is defined and how it is autoloading.
6) Also please let me know "Will it working in your solaris 64bit platform”.
Following is my problem code-
my $compCode = MQCC_FAILED;
my $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(MQRC_UNEXPECTED_ERROR, "\n");
print "-------------------------------------------\n";
$Hconn = MQCONN($qm_name,
\$compCode,
\$Reason,
)|| die "Unable to Connect to Queuemanager\n";
Thanks,
Santosh
________________________________________
From: perl-mqser...@morganstanley.com [perl-mqser...@morganstanley.com]
Sent: Saturday, February 25, 2012 12:55 AM
To: Santosh Sadangi
Cc: perl-mqser...@morganstanley.com; modules@perl.org
Subject: Re: CPAN Mqseries Module for Solaris5.10
On Sat, Feb 25, 2012 at 12:24:08AM +0530, Santosh Sadangi wrote:
> 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
this code seems to work fine here, so let's try something simpler.
what do you get from this:
perl -e 'use MQSeries; print(MQSeries::MQRC_UNEXPECTED_ERROR, "\n");'
> 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?
> >
|