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 » IBM MQ API Support » [Solved] Perl / MQ problem

Post new topic  Reply to topic
 [Solved] Perl / MQ problem « View previous topic :: View next topic » 
Author Message
Cliff
PostPosted: Thu Sep 12, 2002 7:55 am    Post subject: [Solved] Perl / MQ problem Reply with quote

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
View user's profile Send private message Send e-mail
bduncan
PostPosted: Thu Sep 12, 2002 11:10 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website AIM Address
Cliff
PostPosted: Thu Sep 12, 2002 10:59 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
vmcgloin
PostPosted: Thu Sep 12, 2002 11:22 pm    Post subject: Reply with quote

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
View user's profile Send private message
Cliff
PostPosted: Fri Sep 13, 2002 12:31 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ API Support » [Solved] Perl / MQ problem
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.