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 » Challenge with MQopen in Perl

Post new topic  Reply to topic
 Challenge with MQopen in Perl « View previous topic :: View next topic » 
Author Message
sebastian
PostPosted: Wed Jan 14, 2004 5:52 am    Post subject: Challenge with MQopen in Perl Reply with quote

Centurion

Joined: 12 Nov 2003
Posts: 110
Location: Philadelphia

I am having some challenges coding an MQopen in Perl on windows. As a model, I am using a pscript that runs successfully on Unix. The parameter format I am using is:

MQopen(hconn,ObjDesc,options,compcode,reason)

When I try to run the script, I get the message "Reference expected for parameter ObjDesc." Directly before the open, I am moving a valid queue name to this variable so I am not sure why I am getting this message. I have tried updating the ObjDesc variable with single and double quotes and also as a literal value but get the same results. I am using an MQconn before this that works fine.

The actual code is below. Any feedback is appreciated.
thanks,
Seb


#!/opt/perl/bin/perl

#use MQSeries::MQClient;
use MQClient::MQSeries;

$qmgr=PRWAPMQADM01D;
print "$qmgr\n";
#***********************************************************************
#
# connect to QM(s) named in config if connect fails, die
#
#***********************************************************************


################################################################################
print "**attempting MQconn\n";
################################################################################

print "qmgr = $qmgr compcode = $CompCode reason = $reason \n";

$SRCHconn = MQCONN($qmgr,$CompCode,$Reason);

if ($CompCode > 0){

die "can't connect to source $SRCName code $CompCode reason cd $Reason \n";
} else {
print "it looks good \n";
}


print "after qmgr = $qmgr\n";
print "after CompCode = $CompCode\n";
print "after reason = $Reason\n";



################################################################################
print "**attempting MQOPEN\n";
################################################################################
print " \n";

# open parameters

$SRCObjDesc = sebtest;
$SRCOptions = MQOO_INPUT_AS_Q_DEF | MQOO_FAIL_IF_QUIESCING | MQOO_BROWSE;



print "prior to open parameters = SRCHconn = $SRCHconn\n";
print "prior to open parameters = SRCObjDesc = $SRCObjDesc\n";
print "prior to open parameters = SRCOptions = $SRCOptions\n";
print "prior to open parameters = CompCode = $CompCode\n";
print "prior to open parameters = Reason = $Reason\n";


# $SRCHobj = MQOPEN($SRCHconn,$SRCObjDesc,$SRCOptions,$CompCode,$Reason);
$SRCHobj = MQOPEN($SRCHconn,$SRCObjDesc,sebtest,$CompCode,$Reason);

print "after open parameters = SRCHconn = $SRCHconn\n";
print "after open parameters = SRCObjDesc = $SRCObjDesc\n";
print "after open parameters = SRCOptions = $SRCOptions\n";
print "after open parameters = CompCode = $CompCode\n";
print "after open parameters = Reason = $Reason\n";


print "reason2 = $reason\n";
print "comp code2 = $CompCode\n";
if ($CompCode > 0){

print "can't connect to source2 $SRCName code $CompCode reason $ReasonText \n";
# die "can't connect to source2 $SRCName code $CompCode reason $ReasonText \n";
} else {
print "it looks good2 \n";
}
_________________
sebastian signature
Back to top
View user's profile Send private message Visit poster's website
jefflowrey
PostPosted: Wed Jan 14, 2004 6:19 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Quote:
Reference expected for parameter ObjDesc.
This means that you're supplying a simple scalar when it's expecting a reference instead.

You could try passing in \$SRCObjDesc instead of $SRCObjDesc.
But I wonder if it's expecting $SRCObjDesc to be a hash? (I haven't worked with the MQ API in Perl)
_________________
I am *not* the model of the modern major general.


Last edited by jefflowrey on Wed Jan 14, 2004 6:21 am; edited 1 time in total
Back to top
View user's profile Send private message
sebastian
PostPosted: Wed Jan 14, 2004 6:19 am    Post subject: I figured this one out Reply with quote

Centurion

Joined: 12 Nov 2003
Posts: 110
Location: Philadelphia

I checked a bit deeper and found that the ObjDesc needs to be defined as a hash reference. I got this to work but I do not really know why the ObjDesc parameter needs to be defined this way. I thought data was data.

thanks,
Seb
_________________
sebastian signature
Back to top
View user's profile Send private message Visit poster's website
bduncan
PostPosted: Tue Jan 20, 2004 12:01 pm    Post subject: Reply with quote

Padawan

Joined: 11 Apr 2001
Posts: 1554
Location: Silicon Valley

If you look at this table from Chapter 12 of the Application Programming Reference, you'll see that the object descriptor must be a hash in perl, because it is more than just the name of the queue you are trying to open. In your case, the only thing you need to supply is the name of the queue, but sometimes you may need to make use of the other fields in the MQOD:
http://publibfp.boulder.ibm.com/epubs/html/csqzak06/csqzak061q.htm#TBLODCONT
_________________
Brandon Duncan
IBM Certified MQSeries Specialist
MQSeries.net forum moderator
Back to top
View user's profile Send private message Visit poster's website AIM Address
sebastian
PostPosted: Tue Jan 20, 2004 12:14 pm    Post subject: Reply with quote

Centurion

Joined: 12 Nov 2003
Posts: 110
Location: Philadelphia

B:
Thanks for the link.....
_________________
sebastian signature
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » General Discussion » Challenge with MQopen in Perl
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.