MainframeKit

2018

MQRC_HCONN_ERROR (X'07E2')MQ REASON CODE

The connection handle passed on an MQI call is not valid: it was never set, was already disconnected, or is used outside its allowed scope.

MOST LIKELY

MQCONN or MQCONNX was not called, or it failed and the program carried on anyway.

FIRST CHECK

Check that MQCONN or MQCONNX completed successfully before any other call, and that the program stops if it did not.

TRY IT ▸

MainframeKit assistant

What it means

Every MQI call after MQCONN needs the connection handle that MQCONN returned. 2018 means the value passed is not a live handle for this thread or process. This is almost always a program logic or build problem, not a queue manager problem.

Typical causes

  • MQCONN or MQCONNX was not called, or it failed and the program carried on anyway.
  • The program already called MQDISC and then used the old handle.
  • A handle was shared between threads or processes in a way MQ does not allow.
  • On z/OS, the program was link-edited with the wrong MQ stub for its environment, or a stub from a newer MQ release.
  • On CICS, a data conversion exit that calls MQXCNVC is not defined as OPENAPI.

How to fix it

  1. Check that MQCONN or MQCONNX completed successfully before any other call, and that the program stops if it did not.
  2. Make sure the handle is not used after MQDISC and is only used on the thread that is allowed to use it.
  3. On z/OS, link batch programs with CSQBSTUB, CICS programs with CSQCSTUB and IMS programs with CSQQSTUB, at a level no newer than the queue manager.
  4. On CICS, define any conversion exit that calls MQXCNVC as OPENAPI.

Example

Illustrative only; names and values are invented.

MQPUT failed  CompCode=2  Reason=2018  Hconn=0