如何清除问题"com.ibm.mq.MQException: MQJE001: Completion Code 2, Reason 2040"

How to clear the issue "com.ibm.mq.MQException: MQJE001: Completion Code 2, Reason 2040"

我已经使用下面的代码来禁止队列,但是当我尝试禁止时出现错误。
我已经为特定队列尝试了各种开放选项,但我仍然遇到问题。我的代码中还遗漏了什么;

     public void control(String mgrName, String queueName, int openOptions, string option)throws MQException{
     qMgr = new MQQueueManager(mgrName);
       mqQueue = qMgr.accessQueue(queueName, openOptions);    
       if (option.equalsIgnoreCase("stop")){
            System.out.println("Stop mesage received");
             mqQueue.setInhibitGet(MQC.MQQA_GET_INHIBITED);
             System.out.println("Queue inhibitted successfully");
        }else if(option.equalsIgnoreCase("start")){
            System.out.println("Start mesage received");
            mqQueue.setInhibitGet(MQC.MQQA_GET_ALLOWED);
            System.out.println("Queue get allowed successfully");
        }
}

调用此方法时出现以下错误。
com.ibm.mq.MQException:MQJE001:完成代码 2,原因 2040

2040 = MQRC_NOT_OPEN_FOR_SET。 IBM v7.5 知识中心页面“2040 (07F8) (RC2040): MQRC_NOT_OPEN_FOR_SET”描述了此错误的原因:

Explanation

An MQSET call was issued to set queue attributes, but the queue had not been opened for set.

Programmer response

Specify MQOO_SET when the object is opened.

如果传递给 controlopenOptions 包括 MQOO_SET 那么错误应该消失。

示例如下:

int openOptions = MQConstants.MQOO_FAIL_IF_QUIESCING | MQConstants.MQOO_SET