Issue:
Error 2042 displays when browsing messages on a z/OS agent queue with a curdepth of 0. The following is a screenshot of the error message:
When the Description button is clicked, the explanation for error 2042 is displayed. As seen below, it states that the queue is in use.
If a message is added, browsing messages then works as expected.
Resolution:
To prevent this issue, the queue, NASTEL.MMF.ADMIN.COMMAND.QUEUE, on zOS needs its default share option changed to SHARED and permit shared access set to YES. At this point, browsing empty queues will return the No message available value (2033) instead of Object in use (2042).
Once the above changes are done, restart the NSQMSG (message server) started task(s). If this is done on several queue managers, the NSQMSG started task should be restarted for all of the queue managers.