The obvious answer of almost nothing - is half right!
If you are not using shared queue then the queue manager quickly does a check and returns MQRC_UNKNOWN_OBJECT_NAME (2085).
If you are using shared queue, then the queue manager has to go the the queue manager DB2 tables to check. In round numbers this doubles the cost of ta normal MQOPEN.
How can you tell?
You can use MQ events to produce an event when an non zero return code is produced. See below
I spotted this from the MQ accounting information. It had
== DB2 activity : 1 requests > Average time per DB2 request-Server : 784 uS > Average time per DB2 request-Thread : 784 uS > Maximum time per DB2 request-Server : 784 uS > Maximum time per DB2 request-Thread : 830 uS > Bytes put to DB2 : 0 > Bytes read from DB2 : 0
and there was no queue record in the SMF data.
You might also see high activity in the DB2 plan CSQ5R*
In the DB2 accounting data, I had entries with CORRNAME: MQPADB2S where MPQA is the queue manager name, and DB2S is for a Server task
What is the cost?
Tony Sharkey did some measurements. A program just did 1 millions MQOPEN+MQCLOSE.
In round numbers... average cost per MQOPEN+(MQCLOSE) in microseconds
|Queue existed||Queue did not exist|
What can you do about this?
If this is a surprise to you, and you have a system where you can run just a few transactions you can use the MQI call and user parameter, and GTF on z/OS.
it discusses how to take a GTF trace of the API requests. You can use this to trace one transaction and check the return codes from the API requests.
You can use queue manager events. For example An application issues an MQI call that fails. The reason code from the call is the same as the reason code in the event message. You can use the DISPLAY QMGR LOCALEV to check the status. I have not used this.
You can talk to your applications teams and discuss this with them.
One customer has an application, if the queue "PAYROLL.DEBUG" was defined ( and available) the application copied the input and output message to this queue to aid debugging. On a local queue manager this was a cheap call. On Shared queue this would be expensive