Return codes
For each WebSphere MQ Message Queue Interface (MQI) and WebSphere MQ Administration Interface (MQAI) 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.
Applications must not depend upon errors being checked for in a specific order, except where specifically noted. If more than one completion code or reason code could arise from a call, the particular error reported depends on the implementation.
Applications checking for successful completion following a WebSphere MQ API call must always check the completion code. Do not assume the completion code value, based on the value of the reason code.
Completion codes
CompCode
)
allows the caller to see quickly whether the call completed successfully,
completed partially, or failed. The
following is a list of completion codes, with more detail than is
given in the call descriptions: - MQCC_OK
- The call completed fully; all output parameters have been set.
The
Reason
parameter always has the value MQRC_NONE in this case. - MQCC_WARNING
- The call completed partially. Some output parameters might have
been set in addition to the
CompCode
andReason
output parameters. TheReason
parameter gives additional information about the partial completion. - MQCC_FAILED
- The processing of the call did not complete. The state of the
queue manager is unchanged, except where specifically noted. The
CompCode
andReason
output parameters have been set; other parameters are unchanged, except where noted.The reason might be a fault in the application program, or it might be the result of some situation external to the program, for example the user's authority might have been revoked. The
Reason
parameter gives additional information about the error.
Reason codes
The reason code parameter
(Reason
) qualifies 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 must adhere to these rules. In addition, any special reason values defined by user exits must 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 appropriate.
- The
Reason
field of the MQDLH structure - The
Feedback
field of the MQMD structure
For complete descriptions of reason codes, see Reason codes .