MQ

MQ

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
  • 1.  increase maxdepth of all local queues

    Posted Mon February 13, 2023 01:40 PM

    Hello All,

    Please share MQ command to increase maxdepth of all local queues in a queue manager. Thank you.



    ------------------------------
    prashanth katanguri
    ------------------------------


  • 2.  RE: increase maxdepth of all local queues

    Posted Tue February 14, 2023 04:51 AM
    Edited by Matthias Blomme Tue February 14, 2023 07:59 AM

    Hi Prashanth

    I don't beleive there is a singel command to do that, but you can easily script it.

    Powershell (for windows):

    $fullOutput = echo "dis ql(*)" | runmqsc QmgrV10
    $fullOutput | select-string -Pattern '.*QUEUE\((.*?)\).*' | % { "ALTER QL('" + $($_.matches.groups[1].value) + "') MAXDEPTH(99999)" }

    foreach($line in $alterCmd) {
        write-host 'echo "' $line '" | runmqsc QmgrV10' 
    }

    That gives this output:

    echo " ALTER QL('QUEUE.Q2') MAXDEPTH(99999) " | runmqsc QmgrV10

    echo " ALTER QL('QUEUE.Q2') MAXDEPTH(99999) " | runmqsc QmgrV1

    If you change the command to execute and not just print you have the script.

    I'll see if I can get an awk example for on linux later today.

    For linux this should work

    echo dis ql(*) | runmqsc QmgrV10 | grep -oP "(?<=QUEUE\().*?(?=\))" | awk '{printf "ALTER QL(%s) MAXDEPTH(9999)\n",$1}'

    That should give you the printed output again, you need to pipe that to runmqsc if you want to use it


    ------------------------------
    Regards
    Matthias Blomme
    ------------------------------



  • 3.  RE: increase maxdepth of all local queues

    Posted Tue February 14, 2023 04:57 AM

    Hi Prashanth,

    You can do this using MQGem's MQSCX with the following script:-

    foreach(DISPLAY QLOCAL(*))
      @qname=QUEUE
      ALTER QLOCAL(<@qname>) MAXDEPTH(5001)
    endfor

    Cheers,
    Morag



    ------------------------------
    Morag Hughson
    MQ Technical Education Specialist
    MQGem Software Limited
    Website: https://www.mqgem.com
    ------------------------------



  • 4.  RE: increase maxdepth of all local queues

    Posted Tue February 14, 2023 05:09 PM

    Prashanth:

      It's possible, but as is often the case, you need to be careful.  For example, when you say that you want to increase the maxdepth of "all local queues", does this include the SYSTEM.* queues?

      You also don't indicate what O/S is being used.

      Matthias has given you one approach for Windows, and Morag has provided an excellent example of how it can be done if you have MQSCX.

      If, however, you are on Linux, and you want an ugly one line command that might work, we can use the following steps to see how it works.

    - We can use this command filter to list the local queues for a Queue Manager named QM1

    echo "DISPLAY QL(*)" | runmqsc QM1

    - Unfortunately, this has lots of extra lines, so we want to remove those from the list.

    echo "DISPLAY QL(*)" | runmqsc QM1 | egrep -v "AMQ8409I|^ *TYPE|SYSTEM"

    That's better, but still has some extra lines.  We can remove them by only keeping the lines with QUEUE

    echo "DISPLAY QL(*)" | runmqsc QM1 | egrep -v "AMQ8409I|^ *TYPE|SYSTEM" | grep QUEUE

    Now, we want to change these lines to be ALTER commands for these queues

    echo "DISPLAY QL(*)" | runmqsc QM1 | egrep -v "AMQ8409I|^ *TYPE|SYSTEM" | grep QUEUE | sed -e "s/^ *QUEUE/ALTER QLOCAL/" -e "s/)  *TYPE.*$/) MAXDEPTH(50000)/"

    - You didn't specify a new MaxDepth, so I picked 50,000 ...

    - So, the question then becomes how do we execute these commands?  By redirecting them into MQSC again...

    echo "DISPLAY QL(*)" | runmqsc QM1 | egrep -v "AMQ8409I|^ *TYPE|SYSTEM" | grep QUEUE | sed -e "s/^ *QUEUE/ALTER QLOCAL/" -e "s/)  *TYPE.*$/) MAXDEPTH(50000)/" | runmqsc QM1

      This is merely meant to be a demonstration that it can be done.  It is not a recommendation that it SHOULD be done.

      Use caution, and be careful for what you ask.   ;-)

    Good luck

    Bob 



    ------------------------------
    Bob
    ------------------------------



  • 5.  RE: increase maxdepth of all local queues

    Posted Wed February 15, 2023 11:32 AM

    I would like to thank you everyone who supported me for the same. Thank you again.



    ------------------------------
    prashanth katanguri
    ------------------------------



  • 6.  RE: increase maxdepth of all local queues

    Posted Wed February 15, 2023 11:41 AM

    @prashanth katanguri  what did you end up using? 



    ------------------------------
    Regards
    Matthias Blomme
    ------------------------------