This is part of a series of small blog posts which will cover some of the smaller, perhaps less likely to be noticed, features of IBM MQ. Read other posts in this series.
This post is about a very small, but very handy feature in IBM MQ. Although it has been available in the product since at least V6, it is still forgotten about by some. On the various fora where people ask MQ questions a fairly regularly asked one goes something like this:-
"My application says there are no messages to get from the queue but the CURDEPTH says that there are. What does this mean?"
The answer invariably includes reminders to check that your application is clearing out the MessageId before it attempts to get the next message, but also to check that there are no uncommitted messages on the queue. It's that latter feature this post is going to cover.
To check whether there are uncommitted messages on a queue you can very simply use the DISPLAY QSTATUS command. In the following example there is one message on the queue, and it is committed and available to be retrieved. You can tell that because UNCOM says NO - there are no uncommitted messages on the queue.
AMQ8450: Display queue status details.
QUEUE(Q1) TYPE(QUEUE)
CURDEPTH(1) IPPROCS(0)
LGETDATE( ) LGETTIME( )
LPUTDATE( ) LPUTTIME( )
MEDIALOG( ) MONQ(OFF)
MSGAGE( ) OPPROCS(0)
QTIME( , ) UNCOM(NO)
When this feature was originally provided in MQ, if there were uncommitted messages, the answer would come back with UNCOM(YES). However, in newer versions of the Distributed queue manager, this has changed, and UNCOM now reports the number of uncommitted messages. In the following example there are 25 messages on the queue, but 10 of them are uncommitted.
AMQ8450: Display queue status details.
QUEUE(Q1) TYPE(QUEUE)
CURDEPTH(25) IPPROCS(0)
LGETDATE( ) LGETTIME( )
LPUTDATE( ) LPUTTIME( )
MEDIALOG( ) MONQ(OFF)
MSGAGE( ) OPPROCS(1)
QTIME( , ) UNCOM(10)
On the z/OS queue manager, DISPLAY QSTATUS still reports UNCOM(YES) or UNCOM(NO).
So next time your application complains that there are no messages to retrieve but you can see that there is a non-zero CURDEPTH, remember to look for the UNCOM attribute. If there are some uncommitted messages, you can use DISPLAY CONN which was discussed in a previous blog post to find out the culprit that isn't committing the messages.
Morag Hughson is an MQ expert. She spent 18 years in the MQ Devt organisation before taking on her current job writing MQ Technical education courses with
MQGem. She also blogs for
MQGem. You can connect with her here on IMWUC or on
Twitter and
LinkedIn.
#Little-Gem#IBMMQ#ChampionsCorner