Shell script to Move messages from one queue to another

Hello experts,

Can someone guide me to use Shell script to Move messages from queue, please?
Who is Participating?
Duncan RoeConnect With a Mentor Software DeveloperCommented:
Is runmqsc a Windows command? If so, you need to find out which directory it's in and add that to PATH in your script before invoking it e.g. export PATH=$PATH:/cygdrive/c/WINDOWS/system32 (if that's where runmqsc.exe is). Case of PATH components must be exactly right.
Seth SimmonsSr. Systems AdministratorCommented:
your question is too vague
what are you trying to do?  what shell? linux?
what queue?
you need to provide more details and be specific in what you are asking
JammerulesAuthor Commented:
I am sorry for being too brief. Here is what I am planning to do. And please bear in mind my newness to MQ and Unix.

I am using Cygwin simulator to simulate Unix env. In conjunction with MQ Series, I want to write a Unix Shell script to move a message from Queue Manager A to Queue Manager B. Hope this makes a little more sense. Thanks for your quick response!
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

JammerulesAuthor Commented:
if the message is in a file, use he mv command, if not give us enough information to help you. where is that message ? file ? database ?

maybe also you can tag your question as websphere. i'm not very familiar with websphere's internals, possibly people who are will know what you're talking about
JammerulesAuthor Commented:
I have this piece of code that I want to run in Cygwin. How can I go about it? The MQ Server is installed on my local machine.

# Clear a MQ queue (
# Parameters:
#  $1=Queue manager
#  $2=Queue name

if [ $# -ne 2 ] ; then
#  Tell the user what they did wrong!
   echo "Usage:"
   echo " QMgrName QueueName"

echo "clear qlocal($2)" | runmqsc $1


Open in new window

skullnobrainsConnect With a Mentor Commented:
if cygwin is installed, just launch a cygwin bash terminal and call the script using

# bash path/to/script queue_manager queue_name

Open in new window

the path to the script may be either a windows full path, a unix-style absolute path which will in fact be relative to cygwin's installation directory, or a relative path using either the windows or unix syntax

if the script is made executable, you can call it as a command without explicitely specifying "bash" on the command line. this makes no difference in terms of execution

if you use this frequently using he same queue, you can setup a windows shortcut using the above command. in this case, you'll have to specify the complete path to bash
if the above does not help, would you mind making your demand clearer

How can I go about it?

what did you try ? what did you expect ? what happened ?
lgacsConnect With a Mentor Commented:
Use the "qload" utility from MQ support pack MO03.

It can be downloaded from IBM
JammerulesAuthor Commented:
Experts - I am sorry that I could not respond timely by accepting your solutions. Unfortunately, the requirement has changed and hence there is no need for pursuing a solution to my question. As a result, I didn't try any of the solutions. I am accepting all the responses as a possible solution.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.