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 IBM MQ Support » Running MQ scripts in ANT

Post new topic  Reply to topic
 Running MQ scripts in ANT « View previous topic :: View next topic » 
Author Message
GeneRK4
PostPosted: Fri Feb 13, 2015 12:20 am    Post subject: Running MQ scripts in ANT Reply with quote

Master

Joined: 08 Jul 2013
Posts: 220

I want to run MQ scripts in ANT.
When we tried this,its not working.Its not able to detect the "<" in runmqsc.We tried with some options still not working..

If anyone successfully tried this,please share with me..

Here is the detail of our ANT script:
<?xml version="1.0"?>

<project name="project" default="queue.creation">
<property file="build.properties.txt"/>


<!-- Target to Create Queues -->
<target name="queue.creation">

<exec executable="${wmq.home}\runmqsc.exe">

<arg value="${queue.manager}" />

<arg value="&lt;" />

<arg value="${queuefile.name}" />

</exec>

</target>


</project>


Result:
ant -buildfile queues.xml
Buildfile: queues.xml

queue.creation:
[exec] Usage: runmqsc [-e] [-v] [-w WaitTime [-x] [-m LocalQMgrName]] [QMgr
Name]
[exec] 5724-H72 (C) Copyright IBM Corp. 1994, 2009. ALL RIGHTS RESERVED.
[exec]
[exec] Result: 20

BUILD SUCCESSFUL
Total time: 0 seconds

=====================================
Result 20 Error- MQSC command file not run
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Fri Feb 13, 2015 7:09 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20696
Location: LI,NY

create a little batch program say
Code:
@echo off
runmqsc %1 < %2.mqsc > %1_%2.log 2>&1

and run this batch program instead of runmqsc...

Should have the same effect and you don't have to mess with redirection...

You did not specify the platform, but I am sure you know which changes to make to the batch file to run under Unix/Linux...
And remember, in windows some things need to be run from an elevated command prompt...
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
GeneRK4
PostPosted: Mon Feb 16, 2015 12:54 am    Post subject: Reply with quote

Master

Joined: 08 Jul 2013
Posts: 220

Created a batch file myrunmqsc.bat with the below contents:

@echo off
runmqsc %1 < %2

But getting the below error:

C:\Users\291861>ant -buildfile queues.xml
Buildfile: queues.xml

queue.creation:
[exec] Result: 255

BUILD SUCCESSFUL

==================================
Result:255 is error and hence it didnt work for us.

When we try to give runmqsc %1 < %2.mqsc > %1_%2.log 2>&1 in bat file its showing "> unexpected".
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Mon Feb 16, 2015 4:59 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20696
Location: LI,NY

GeneRK4 wrote:
Created a batch file myrunmqsc.bat with the below contents:

@echo off
runmqsc %1 < %2

But getting the below error:

C:\Users\291861>ant -buildfile queues.xml
Buildfile: queues.xml

queue.creation:
[exec] Result: 255

BUILD SUCCESSFUL

==================================
Result:255 is error and hence it didnt work for us.

When we try to give runmqsc %1 < %2.mqsc > %1_%2.log 2>&1 in bat file its showing "> unexpected".


Can you give the exact command in the batch file between [ c o d e ] tags? And also how you call it from ant.
Have you looked at the log the command is writing to? It should show you exactly what went wrong and why...
You should not get any unexpected... unless you added some spaces where you shouldn't have...
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
GeneRK4
PostPosted: Wed Mar 04, 2015 1:29 am    Post subject: Reply with quote

Master

Joined: 08 Jul 2013
Posts: 220

Though we gave as below,it didn't work

@echo off
runmqsc %1 < %2.mqsc > %1_%2.log 2>&1

ANT tasks were not able to recognize ‘<’ argument.
So we changed the batch file like below:
@echo off
runmqsc %1 %2 %3
where 1st parameter is Queue manager, 2nd parameter is ‘<’ and 3rd parameter is the file with MQSC commands.

And ANT task will be like this:
<!-- Target to Create Queues -->
<target name="Queue.creation">
<if>
<equals arg1="${createQueue}" arg2="yes" />
<then>
<echo message="Creating Queues.. "/>
<exec executable="${wmq.home}\myrunmqsc.bat">
<arg value="${queue.manager}" />
<arg value="&lt;" />
<arg value="${queue.def}" />
</exec>
<echo message="Successfully created Queues" />
</then>
</if>
</target>

Its working fine now
Back to top
View user's profile Send private message
tsuru
PostPosted: Thu May 21, 2015 1:26 pm    Post subject: Reply with quote

Novice

Joined: 25 Nov 2005
Posts: 24
Location: São Paulo

You must use a redirector (https://ant.apache.org/manual/Types/redirector.html) to redirect the script content to runmqsc

Code:
<exec executable="runmqsc">
<arg value="${qmgr}"/>
<redirector input="script.mqsc" />
</exec>
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » General IBM MQ Support » Running MQ scripts in ANT
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.