Use the MQPUT1 call when you want to close the queue immediately after you have put a single message on it. For example, a server application is likely to use the MQPUT1 call when it is sending a reply to each of the different queues.
MQPUT1 is functionally equivalent to calling MQOPEN followed by MQPUT, followed by MQCLOSE. The only difference in the syntax for the MQPUT and MQPUT1 calls is that for MQPUT you must specify an object handle, whereas for MQPUT1 you must specify an object descriptor structure (MQOD) as defined in MQOPEN (see Identifying objects (the MQOD structure)). This is because you need to give information to the MQPUT1 call about the queue it has to open, whereas when you call MQPUT, the queue must already be open.
As input to the MQPUT1 call, you must supply:
The output from MQPUT1 is:
If the call completes successfully, it also returns your options structure and your message descriptor structure. The call modifies your options structure to show the name of the queue and the queue manager to which the message was sent. If you request that the queue manager generate a unique value for the identifier of the message you are putting (by specifying binary zero in the MsgId field of the MQMD structure), the call inserts the value in the MsgId field before returning this structure to you.
The six input parameters for MQPUT1 are:
In the ObjectName and ObjectQMgrName fields, give the name of the queue on which you want to put a message, and the name of the queue manager that owns this queue.
The DynamicQName field is ignored for the MQPUT1 call because it cannot use model queues.
Use the AlternateUserId field if you want to nominate an alternate user identifier that is to be used to test authority to open the queue.
When the Options field is set to zero, the queue manager uses your own user ID when it performs tests for authority to access the queue. Also, the queue manager ignores any alternate user identifier given in the AlternateUserId field of the MQOD structure.
When you use clusters, MQPUT1 operates as though MQOO_BIND_NOT_FIXED is in effect. Applications must use the resolved fields in the MQPMO structure rather than the MQOD structure to determine where the message was sent. See WebSphere MQ Queue Manager Clusters for more information.
There is a description of the MQPUT1 call in WebSphere MQ Application Programming Reference.