|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
[Solved] Perl / MQ problem |
« View previous topic :: View next topic » |
Author |
Message
|
Cliff |
Posted: Thu Sep 12, 2002 7:55 am Post subject: [Solved] Perl / MQ problem |
|
|
Centurion
Joined: 27 Jun 2001 Posts: 145 Location: Wiltshire
|
Folks,
I am knocking up a utility to run some commands and have come across a problem determining whether the command server is running. Now my Perl is rather rusty, not that it was that good to start with, so bear with me .....
The problem is how to capture and interrogate the AMQnnnn message from the strmqcsv command, in this kind of code:
sub startCmdSvr
{
local $Qmgr = $_[0];
local $cmd = "strmqcsv $Qmgr";
local $rc = system($cmd);
print "Return Code from strmqcsv is $rc\n";
if ($rc == 0)
{
print LOGFILE "Command server for Queue Manager $Qmgr started successfully.\n";
}
else
{
# $rc always = 5120. Need to do something natty here.
}
return(0);
}
I have tried various ways of piping the system output to a file, but with no luck. Can anyone help me?
Thanks -
Cliff |
|
Back to top |
|
 |
bduncan |
Posted: Thu Sep 12, 2002 11:10 am Post subject: |
|
|
Padawan
Joined: 11 Apr 2001 Posts: 1554 Location: Silicon Valley
|
Look at the makeq.pl example in the software repository. Here's the link:
http://www.mqseries.net/pafiledb203/pafiledb.php?action=viewfile&fid=3&id=1
While it doesn't use the command server, it does invoke 'runmqsc' from the command line in the same way, and uses a two-way interactive pipe. This way, it can issue commands to runmqsc and parse the output from it... _________________ Brandon Duncan
IBM Certified MQSeries Specialist
MQSeries.net forum moderator |
|
Back to top |
|
 |
Cliff |
Posted: Thu Sep 12, 2002 10:59 pm Post subject: |
|
|
Centurion
Joined: 27 Jun 2001 Posts: 145 Location: Wiltshire
|
Brandon,
this is precisely what puzzles me. I already use runmqsc in this way:
local $cmd = "runmqsc $Qmgr < $mqCmdIn > $qmCmdOut";
local $rc = system($cmd);
and this gives the results one would expect. Sadly the same approach does not work for strmqcsv. Try it, and you'll see what I mean.
So, all you Perl gurus out there, can you set me straight??
Thanks -
Cliff |
|
Back to top |
|
 |
vmcgloin |
Posted: Thu Sep 12, 2002 11:22 pm Post subject: |
|
|
Knight
Joined: 04 Apr 2002 Posts: 560 Location: Scotland
|
I found that if I run "strmqcsv VMC_TEST >test.out" then test.out is empty. But, if I run "strmqcsv VMC_TEST 2>test.out" then test.out contains the messages.
It looks like strmqcsv is writing to stderr instead of stdout. |
|
Back to top |
|
 |
Cliff |
Posted: Fri Sep 13, 2002 12:31 am Post subject: |
|
|
Centurion
Joined: 27 Jun 2001 Posts: 145 Location: Wiltshire
|
Thanks, Vicky.
That's fixed it. Told you my Perl was rusty ....
Cheers - Cliff |
|
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
|
|
|
|