2

The IBM RedBook instructions didn't help.

I need to give a script a queue manager and a queue/topic name, and have it return the number of messages queued up.

2 Answers 2

3

I'm probably missing something here (turns out I was), as it's been about a year since I dealt with MQ at all and even then it was only peripherally, but wouldn't this command from the doc you linked give you the queue depth for a particular queue?

Deleted old incorrect answer

Per Andrew's correct answer, you need to pipe the command to runmqsc.

echo "display ql(queue_name) curdepth" | runmqsc queue_manager_name
3
  • Turns out I needed to use amqspsd to resolve the name of the queue. After resolving I was able to use runmqsc.
    – brianegge
    Sep 17, 2009 at 3:30
  • Which version of MQ does this work on? I keep getting invalid syntax, then the list of options.
    – FilBot3
    Jan 5, 2015 at 21:36
  • It doesn't work on any version of MQ. runmqsc is interactive. You either type it on a command line then enter the commands once inside its shell, or else pipe the commands to it. See Andrew's correct (but oddly not accepted) solution.
    – T.Rob
    Feb 22, 2017 at 22:24
4

This command should work:

echo "display ql(queue_name) curdepth" | runmqsc queue_manager_name

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .