# MQRC 2039: Handle not open for output

Source: https://wndsoftware.com/mainframe-errors/mqrc-2039

### MQRC 2039: Handle not open for output

MQRC 2039 means MQPUT used a queue handle without output capability. Check the MQOPEN options and whether code reused a consumer or browse handle.


#### Other names for this code

Also written as `RC2039`, `reason code 2039`, `MQ error 2039`, `MQRC_NOT_OPEN_FOR_OUTPUT`, `07F7`, `0x07F7`.


### What it means

MQPUT needs a handle opened with MQOO_OUTPUT. Having a valid connection and a valid queue handle is not sufficient when the handle was opened only for input, browse or inquiry.

The error identifies an API usage mismatch. It does not by itself establish that the queue is disabled for puts; MQRC 2051 reports that different condition.


#### A troubleshooting example

A worker gets a request from REQUEST.IN and sends its reply using the same handle variable. The reply fails with 2039 because that handle was opened for input. The correct change is to resolve the actual reply queue from the message contract, open that queue for output and put through the new handle. Test with distinct input and reply queues so a variable mix-up cannot accidentally appear to work. Inspect the destination of the resulting message, not only the absence of an exception.


### Common causes

- A request processor reuses its input handle to send a reply.
- A handle cache indexes only by queue name and ignores open capabilities.
- A refactor replaces an output open with an inquiry or browse open while retaining the same variable.


### How to find the problem

- Capture the exact Hobj passed to MQPUT and trace its creation. Check for variable reassignment and cached-handle reuse.
- Inspect the open-options mask at runtime, not only a configuration file. Conditional initialization may select a different mode.
- For replies, compare the reply destination with the input queue and verify that the program obtains an output handle for that destination.
- Check the earlier completion code from MQOPEN. Do not continue using a handle after an unsuccessful open.


### How to fix it

- Open the destination with MQOO_OUTPUT and use that handle for puts. Keep its ownership and cleanup separate from the input handle.
- If using a handle cache, include required capabilities in the cache design. A queue-name match alone cannot guarantee a usable producer handle.
- Test successful replies and failed-open paths. Verify that every put uses the intended destination and that a failed open prevents subsequent message calls.


### What it looks like


```text
Illustrative diagnostic notes; not an IBM message template.
MQOPEN REQUEST.IN: MQOO_INPUT_SHARED
MQPUT using input Hobj: Reason=2039
Open the intended destination with MQOO_OUTPUT.
```


### IBM documentation

[IBM MQ 9.4: 2039 MQRC_NOT_OPEN_FOR_OUTPUT](https://www.ibm.com/docs/en/ibm-mq/9.4.x?topic=codes-2039-07f7-rc2039-mqrc-not-open-output). Use the documentation for your installed release.

[Report a correction to WND Software](https://wndsoftware.com/contact#message).

Technical reviewer: [Albert Joseph](https://wndsoftware.com/authors/albert-joseph), WND Software.

Updated 2026-10-23. IBM documentation checked for this article. Written in our own words. For the full reference, check IBM’s MQ documentation for your version.


### Related codes

[MQRC 2051 MQRC_PUT_INHIBITED Read →](https://wndsoftware.com/mainframe-errors/mqrc-2051)
[MQRC 2037 MQRC_NOT_OPEN_FOR_INPUT Read →](https://wndsoftware.com/mainframe-errors/mqrc-2037)
[MQRC 2019 MQRC_HOBJ_ERROR Read →](https://wndsoftware.com/mainframe-errors/mqrc-2019)

### Questions


#### Is this the same as PUT(DISABLED)?

No. 2039 identifies a handle without output capability. 2051 identifies puts inhibited on the queue or resolved destination.


#### Does reconnecting add output capability?

No. The required capability comes from the object open. Correct the open and the handle passed to MQPUT.

[IBM MQ reason codes](https://wndsoftware.com/mainframe-errors/mq-reason-codes) · [MQRC 2038](https://wndsoftware.com/mainframe-errors/mqrc-2038) · [MQRC 2040](https://wndsoftware.com/mainframe-errors/mqrc-2040)

[← All error codes](https://wndsoftware.com/mainframe-errors/)
