Author |
Message
|
patrick flaherty |
Posted: Mon Mar 27, 2006 4:03 pm Post subject: MGET: "Unable to allocate memory". |
|
|
Novice
Joined: 27 Mar 2006 Posts: 14 Location: SF E Bay
|
Hi,
New to MQS but experienced programmer.
I wrote a first MQ Put perl script on Windows (downloaded and built the MQSeries module from CPAN). That worked.
Then wrote a listener (MQGET) in an MQSeries client that we have running on VMS (our legacy platform).
That worked also.
Am now trying to do an MQGET for the first time on Windows and received the following message:
DB<1> b 29
DB<2> c
main::(mqs_lookup.pl:29): $Buffer = MQGET($Hconn,$Hobj,$MsgDesc,$GetMsgOpt
s,$BufferLength,$CompCode,$Reason);
DB<2> n
Unable to allocate memory in MQGET!
My code
Quote: |
use MQSeries;
$Hconn = MQCONN("",$CompCode,$Reason);
$ObjDesc = {
ObjectName => 'TEST5.QUEUE',
DynamicQName => 'FOOBAR*',
};
$Options = MQOO_INPUT_AS_Q_DEF | MQOO_FAIL_IF_QUIESCING;
$Hobj = MQOPEN($Hconn,$ObjDesc,$Options,$CompCode,$Reason);
($ReasonText) = MQReasonToText($Reason);
# $GetMsgOpts = {
# Options => MQGMO_FAIL_IF_QUIESCING | MQGMO_SYNCPOINT | MQGMO_WAIT,
# WaitInterval => MQWI_UNLIMITED,
# };
my $GetMsgOpts = { Options => MQGMO_FAIL_IF_QUIESCING | MQGMO_WAIT, WaitInterval => 600000,
MatchOptions => MQMO_NONE };
my $MsgDesc = {MsgId=>MQMI_NONE,CorrelId=>MQCI_NONE,Encoding=>MQENC_NATIVE,CodedCharSetId=>MQCCSI_Q_MGR};
# my $MsgDesc->{'Out' => MQFMT_STRING};
my $BuggerLength=512;
my $Buffer;
$Buffer = MQGET($Hconn,$Hobj,$MsgDesc,$GetMsgOpts,$BufferLength,$CompCode,$Reason);
# ($ReasonText) = MQReasonToText($Reason);
foreach $key (keys %$MsgDesc)
{
print "$key: %$MsgDesc->{$key}\n";
}
# parse message
@fields = split(" ",$Buffer);
$CloseOptions = {};
MQCLOSE($Hconn,$Hobj,$CloseOptions,$CompCode,$Reason);
MQDISC($Hconn,$CompCode,$Reason);
|
|
|
Back to top |
|
 |
patrick flaherty |
Posted: Mon Mar 27, 2006 4:05 pm Post subject: Also |
|
|
Novice
Joined: 27 Mar 2006 Posts: 14 Location: SF E Bay
|
I'm running ActiveState perl 5.6.
It's occurred to me that I might want to rip up the current installation; install 5.8; and then reinstall the perl MQSeries module.
(although I'd rather not obviously). |
|
Back to top |
|
 |
jefflowrey |
Posted: Mon Mar 27, 2006 4:43 pm Post subject: Re: MGET: "Unable to allocate memory". |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
patrick flaherty wrote: |
my $BuggerLength=512;
my $Buffer;
$Buffer = MQGET($Hconn,$Hobj,$MsgDesc,$GetMsgOpts,$BufferLength,$CompCode,$Reason); |
Does the Bugger have a length, or the Buffer? _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
patrick flaherty |
Posted: Mon Mar 27, 2006 4:45 pm Post subject: |
|
|
Novice
Joined: 27 Mar 2006 Posts: 14 Location: SF E Bay
|
Ah thanx.
I keep making that mistake for reasons I'm unaware of. (it's curious how when one makes typos, that, for a given word, it's usually the same typo).
pat |
|
Back to top |
|
 |
patrick flaherty |
Posted: Mon Mar 27, 2006 4:48 pm Post subject: |
|
|
Novice
Joined: 27 Mar 2006 Posts: 14 Location: SF E Bay
|
And even better.
After making the change, the code now runs properly.
Duh.
Just added a
use strict;
Which, in theory, is something one should never do without in perl.
pat |
|
Back to top |
|
 |
jefflowrey |
Posted: Mon Mar 27, 2006 4:49 pm Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
The real problem I'm having is refraining from making any more 'bugger' jokes. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
patrick flaherty |
Posted: Mon Mar 27, 2006 4:54 pm Post subject: |
|
|
Novice
Joined: 27 Mar 2006 Posts: 14 Location: SF E Bay
|
Well of course. That's the problem isn't it.
Or rather was.
Now the code works.
(you're not English are you?). |
|
Back to top |
|
 |
patrick flaherty |
Posted: Mon Mar 27, 2006 4:56 pm Post subject: |
|
|
Novice
Joined: 27 Mar 2006 Posts: 14 Location: SF E Bay
|
I looked the 'other one' up.
Booger.
Am Slang. Couldn't remember how to spell it. |
|
Back to top |
|
 |
EddieA |
Posted: Mon Mar 27, 2006 10:44 pm Post subject: |
|
|
 Jedi
Joined: 28 Jun 2001 Posts: 2453 Location: Los Angeles
|
Except, that as a displaced Brit, I can tell you that there's absolutely no correlation between Bugger and Booger.
Cheers, _________________ Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0 |
|
Back to top |
|
 |
Nigelg |
Posted: Mon Mar 27, 2006 11:37 pm Post subject: |
|
|
Grand Master
Joined: 02 Aug 2004 Posts: 1046
|
Quote: |
The real problem I'm having is refraining from making any more 'bugger' jokes.
|
Why refrain? Let them roll!
If you did not know...
In Britain, bugger (as a verb) is a synonym for sodomise, though this is quite a rare usage.
Usually, the word is used to connotate something fouled (****ed) up. _________________ MQSeries.net helps those who help themselves.. |
|
Back to top |
|
 |
Vitor |
Posted: Tue Mar 28, 2006 12:35 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
Also used as the British equivalent of "Doh"!
(At least by me!) _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
jefflowrey |
Posted: Tue Mar 28, 2006 5:55 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Now, most people would think that a bug in your code is always a right bugger, but the real problem I'm having is that the bugger of his code was the bugger in his code and it's a bugger to have to fix if you don't keep your eye on the bugger itself.
And now he's trying to measure the bugger's length, as if we wanted to draw the bugger out. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
|