While doing some work with MQSeries, I got an error “MQJE001: Completion Code 2, Reason 2045” in MQQueueManager.accessQueue() which translates to “MQRC_OPTION_NOT_VALID_FOR_TYPE”. Hm. Hey, IBM, how about adding real error messages to your products instead of having people look up odd codes in tables?
Anyway, the error means that I’m trying to open a queue for output which doesn’t support this. For example, remote queues can be opened with the option MQC.MQOO_OUTPUT but not with MQOO_BROWSE or MQOO_INPUT_AS_Q_DEF. Other queues don’t allow to read from them, i.e. you have to get rid of MQC.MQOO_INPUT_AS_Q_DEF in the openOptions.
See this page for all possible combinations: MQOPEN – Open object
It is quit opposit. Remotes queus open with MQOO_OUTPUT. But not withMQOO_INPUT_AS_Q_DEF
Good catch. I’ve fixed the post and added a link to the documentation page which contains a table which option/queue type combination is valid.