How to check if a queue name already exists in IBM MQ for Linux?

if [[ $(dspmq | grep '(Running)' | grep "$QMgr" | wc -l | tr -d " ") != 1 ]]

The above code should check if the queue manager is working or not.

Is there any command to check if the specified queue name exists in the queue manager?

+4
source share
3 answers

Adding another sentence in addition to what Rob and T. Rob said.

MQ v7.1 and higher come with the dmpmqcfg command, and you can use this to check for a specific queue.

The following examples correspond to your sample, which checks if the queue manager is running:

To use dmpmqcfg to check if a queue name of any type exists, you can do this:

if dmpmqcfg -m ${QMgr} -t queue -x object -o 1line -n ${QName}|egrep '^DEFINE '; then
  echo "Queue ${QName} exists on Queue Manager ${QMgr}
fi

Rob Parker, *, , :
* . DISPLAY Q( DISPLAY QLOCAL(

if printf "DISPLAY Q(${QName})" | runmqsc ${QMgr} 2>&1 >/dev/null; then
  echo "Queue ${QName} exists on Queue Manager ${QMgr}
fi

:

if dspmq -m ${QMgr}| grep --quiet '(Running)'; then
  echo "Queue Manager ${QMgr} is Running"
fi
+4

, :

printf "DISPLAY QLOCAL(<QUEUE NAME>)" | runmqsc <QM Name>

10, , 0, . , , -, , ! (20 )

, , , QLocal, , .

+3

, , - . , RC=0, RC=2 2035 MQRC_NOT_AUTHORIZED. , RC=2 2085 MQRC_UNKNOWN_OBJECT_NAME.

- , , , . , , , . API.

, , PCF, DIS Q(<QUEUE NAME>), . - , - , . , . MQ, -, runmqsc, , , .. , , - Production .

On the other hand, tooling applications should usually be able to request things like queue inventory, so it is expected that they will have access and use the command queue for this function or have access to runmqscrequest from scripts.

+2
source

Source: https://habr.com/ru/post/1667892/


All Articles