MQ depth Periodically

Hi

I am trying to a write a script which gives message queue depth for every 5 mins in a file.
Commands that I use are

 
runmqsc QM_Name
display ql(*) curdepth

Since I can use only MQSC commands I need help on how to fetch the output on to a file after executing display command.

Just redirect output to a pipe, use sed or awk or whatever to rearrange it into nice log lines, and append it to your log file. Anything that does not look like data should be logged in a process log.

I haven't been doing that sort of MQ for a while, send some example output data.

Hi,

The output looks like this:

 
$ runmqsc QM_ICSPN_C                                                                                                                                                                    
5724-B41 (C) Copyright IBM Corp. 1994, 2002.  ALL RIGHTS RESERVED.
Starting MQSC for queue manager QM_name.
display ql (AP*) curdepth
     1 : display ql (AP*) curdepth
AMQ8409: Display Queue details.
   QUEUE(AP/CONNECTOR1/server_name)        CURDEPTH(0)
AMQ8409: Display Queue details.
   QUEUE(AP/CONNECTOR2/server_name)
   CURDEPTH(0)                          
AMQ8409: Display Queue details.
   QUEUE(AP/CONNECTOR3/server_name)       CURDEPTH(0)
AMQ8409: Display Queue details.
   QUEUE(AP/CONNECTOR4/server_name)    CURDEPTH(0)
AMQ8409: Display Queue details.
   QUEUE(AP/JCONNECTOR5/server_name)      CURDEPTH(0)
AMQ8409: Display Queue details.
   QUEUE(AP/CONNECTOR6/server_name)
   CURDEPTH(0)                          
AMQ8409: Display Queue details.
   QUEUE(AP/CONNECTOR7/server_name)
   CURDEPTH(0)                          
AMQ8409: Display Queue details.
sed -n '
  s/^   QUEUE(\([^)]*\)) *CURDEPTH(\([0-9]*\))/\1 \2/p
 '