Search code examples
javaibm-mqmqpcf

How to know which parameter is incorrect in MQ PCF command?


I am using MQ PCF command in Java to create MQ queues and updating their parameters. Following is the code I am using.

PCFMessageAgent agent = new PCFMessageAgent(queueManager);
agent.setCheckResponses(false);
PCFMessage[] responses;
PCFMessage request = new PCFMessage(MQConstants.MQCMD_CHANGE_Q);
responses = agent.send(request);

I am setting the following attributes on the request

MQCA_Q_NAME=TestTQ1
MQIA_BACKOUT_THRESHOLD=0
MQIA_MAX_MSG_LENGTH=4194304
MQIA_MAX_Q_DEPTH=500
MQIA_Q_TYPE=1

and I get the following response Completion Code = 2 Reason Code = 3014
Documentation says that this is due to

Parameter identifier is not valid.
The MQCFIN or MQCFIN64 Parameter field value was not valid.

The question is how do I know which parameter is incorrect?


Solution

  • The first PCFMessage in responses should have one PCFParamter, which should be a MQCFIN, whose type is MQIACF_PARAMETER_ID and whose value will contain the ID of the attribute that the error is on.

    int errParamId = responses[0].getIntParameterValue(MQC.MQIACF_PARAMETER_ID);