|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Challenge with MQopen in Perl |
« View previous topic :: View next topic » |
Author |
Message
|
sebastian |
Posted: Wed Jan 14, 2004 5:52 am Post subject: Challenge with MQopen in Perl |
|
|
 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 |
|
 |
jefflowrey |
Posted: Wed Jan 14, 2004 6:19 am Post subject: |
|
|
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 |
|
 |
sebastian |
Posted: Wed Jan 14, 2004 6:19 am Post subject: I figured this one out |
|
|
 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 |
|
 |
bduncan |
Posted: Tue Jan 20, 2004 12:01 pm Post subject: |
|
|
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 |
|
 |
sebastian |
Posted: Tue Jan 20, 2004 12:14 pm Post subject: |
|
|
 Centurion
Joined: 12 Nov 2003 Posts: 110 Location: Philadelphia
|
B:
Thanks for the link..... _________________ sebastian signature |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
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
|
|
|
|