Learn it on Mainframe Path. Do it with Mainframe KIT.Learn on Mainframe Path ▸
Mainframe KIT ● Nothing leaves this tab

2018

MQRC_HCONN_ERROR (X'07E2')MQ REASON CODE · CHECKED 2026-11-14
Checked against IBM documentation

The connection handle passed on an MQI call is not valid: not returned by MQCONN, already disconnected, or used outside its allowed scope.

QUICK ANSWER

The connection handle passed on an MQI call is not valid: not returned by MQCONN, already disconnected, or used outside its allowed scope.

LIKELY CAUSES, IN THE ORDER OF THIS ENTRY

  1. The handle was not returned by an earlier MQCONN or MQCONNX call, or the parameter pointer is not valid.
  2. The handle was made invalid by an earlier MQDISC, including a shared handle disconnected by another thread.
  3. A nonshared handle is used on a thread that did not create it, or a shared handle is used on MQBEGIN.
  4. On z/OS, the program was linked with the wrong stub or one from a newer queue manager release.
  5. On CICS, a character conversion exit that calls MQXCNVC is not defined as OPENAPI.

CHECKED 14 Nov 2026 IBM: 2018 (07E2) (RC2018): MQRC_HCONN_ERROR - IBM MQ 10.0.x

MOST LIKELY

The handle was not returned by an earlier MQCONN or MQCONNX call, or the parameter pointer is not valid.

FIRST CHECK

Make sure a successful MQCONN or MQCONNX was done and that MQDISC has not already been issued for the handle.

TRY IT ▸

Site search

What it means

Every MQI call after connecting needs the Hconn value from a successful MQCONN or MQCONNX. This reason code means the handle supplied is not valid for the call. The completion code is MQCC_FAILED.

Typical causes

  • The handle was not returned by an earlier MQCONN or MQCONNX call, or the parameter pointer is not valid.
  • The handle was made invalid by an earlier MQDISC, including a shared handle disconnected by another thread.
  • A nonshared handle is used on a thread that did not create it, or a shared handle is used on MQBEGIN.
  • On z/OS, the program was linked with the wrong stub or one from a newer queue manager release.
  • On CICS, a character conversion exit that calls MQXCNVC is not defined as OPENAPI.

How to fix it

  1. Make sure a successful MQCONN or MQCONNX was done and that MQDISC has not already been issued for the handle.
  2. Use the handle only within its valid scope, as described for MQCONN.
  3. On z/OS, link with CSQBSTUB for batch, CSQCSTUB for CICS and CSQQSTUB for IMS, and use a stub no newer than the queue manager release.
  4. On CICS, define the conversion exit that calls MQXCNVC as OPENAPI.

Example

Illustrative only; names and values are invented.

MQPUT failed  CompCode=2  Reason=2018  Hconn=0