I'm trying to use QMHRCVM API to receive messages from a message queue. But the API returns a CPF2451E error very often. The error means "Message queue is allocated to another job". I can't figure out when the error happens. Could you tell me when the error occurs and any way to avoid the error or alternative way to receive messages from a message queue?
This error occurs when another job (such as the user profile it may be allocated) has the message queue allocate with either *NOTIFY or *BREAK. You can handle the error message in your code. The only other API that will allow you to handle messages is the QMHLSTM API, which will allow you to list messages for any non-program message queue into user space.
This was first published in July 2001