API completion and reason codes
For each call, a completion code and a reason code are returned by the queue manager or by an exit routine, to indicate the success or failure of the call.
For more information about the IBM® MQ API, see Developing applications, and the reference information in Developing applications reference.
For a full list and explanation of the API reason codes, see API completion and reason codes.
API completion codes
- 0: Successful completion (MQCC_OK)
-
The call completed fully; all output parameters have been set.
The Reason parameter always has the value MQRC_NONE in this case.
- 1: Warning (partial completion) (MQCC_WARNING)
-
The call completed partially. Some output parameters might have been set in addition to the
CompCode
andReason
output parameters.The Reason parameter gives additional information.
- 2: Call failed (MQCC_FAILED)
-
The processing of the call did not complete, and the state of the queue manager is normally unchanged; exceptions are specifically noted. Only the
CompCode
andReason
output parameters have been set; all other parameters are unchanged.The reason might be a fault in the application program, or it might be a result of some situation external to the program, for example the application's authority might have been revoked. The Reason parameter gives additional information.
API reason codes
The reason code parameter (Reason) is a qualification to the completion code parameter (CompCode).
If there is no special reason to report, MQRC_NONE is returned. A successful call returns MQCC_OK and MQRC_NONE.
If the completion code is either MQCC_WARNING or MQCC_FAILED, the queue manager always reports a qualifying reason; details are given under each call description.
Where user exit routines set completion codes and reasons, they should adhere to these rules. In addition, any special reason values defined by user exits should be less than zero, to ensure that they do not conflict with values defined by the queue manager. Exits can set reasons already defined by the queue manager, where these are appropriate.
- The
Reason
field of the MQDLH structure - The
Feedback
field of the MQMD structure
From IBM MQ 9.1.0, where multiple client connection attempts are made, for example with a channel with a comma separated connection name and the connection sequence fails, reason codes other than MQRC_HOST_NOT_AVAILABLE and MQRC_STANDBY_Q_MGR are given priority when being returned to an application. In previous versions of the product, the last reason code encountered in the connection sequence is always returned, this could lead to configuration errors such as MQRC_NOT_AUTHORIZED encountered earlier in the connection attempt to not be returned to the application.
- Are one or more platform icons at the top of a reason code, in which case that reason code applies only to those platforms shown.
- Is a platform icon displayed against a specific statement, in which case that statement applies only to that platform.
- an explanation of the circumstances that have caused the code to be raised
- the associated completion code
- suggested programmer actions in response to the code