2018 (07E2) (RC2018): MQRC_HCONN_ERROR


The connection handle Hconn is not valid, for one of the following reasons:
  • The parameter pointer is not valid, or (for the MQCONN or MQCONNX call) points to read-only storage. (It is not always possible to detect parameter pointers that are not valid; if not detected, unpredictable results occur.)
  • The value specified was not returned by a preceding MQCONN or MQCONNX call.
  • The value specified has been made invalid by a preceding MQDISC call.
  • The handle is a shared handle that has been made invalid by another thread issuing the MQDISC call.
  • The handle is a shared handle that is being used on the MQBEGIN call (only nonshared handles are valid on MQBEGIN).
  • The handle is a nonshared handle that is being used a thread that did not create the handle.
  • The call was issued in the MTS environment in a situation where the handle is not valid (for example, passing the handle between processes or packages; note that passing the handle between library packages is supported).
  • The conversion program is not defined as OPENAPI, when the MQXCNVC call is invoked by running a character conversion exit program with CICS® TS 3.2 or higher. When the conversion process runs, the TCB is switched to the Quasi Reentrant (QR) TCB, making the connection incorrect.

Completion code


Programmer response

Ensure that a successful MQCONN or MQCONNX call is performed for the queue manager, and that an MQDISC call has not already been performed for it. Ensure that the handle is being used within its valid scope (see the description of MQCONN in MQCONN for more information about MQCONN).
  • [z/OS]On z/OS®, also check that the application has been linked with the correct stub; this is CSQCSTUB for CICS applications, CSQBSTUB for batch applications, and CSQQSTUB for IMS applications. Also, the stub used must not belong to a release of the queue manager that is more recent than the release on which the application will run.

Ensure the character conversion exit program run by your CICS TS 3.2 or higher application, which invokes the MQXCNVC call, is defined as OPENAPI. This definition prevents the 2018 MQRC_HCONN_ERROR error caused by from an incorrect connection, and allows the MQGET to complete.