I am working on IIB 10 toolkit.I have to stop a message flow which listens to a queue.How to inhibit the input queue of that messageflow from another service using esql commands?I know the mqsc commands to alter the queues, but don't know to do the same from esql code.Please help.
Hi, please find the code below: I got this from a forum and I still have doubts on this code like how to specify the q manager to which the queue is associated with.
CREATE NEXTSIBLING OF OutputRoot.Properties DOMAIN 'MQMD';
CREATE NEXTSIBLING OF OutputRoot.MQMD DOMAIN 'MQADMIN' NAME 'MQPCF';
CREATE FIELD OutputRoot.MQPCF;
DECLARE refRequest REFERENCE TO OutputRoot.MQPCF;
SET refRequest.Command = MQCMD_CHANGE_Q;
/* First parameter: Queue Name. */
SET refRequest.Parameter[1] = MQCA_Q_NAME;
SET refRequest.Parameter[1].* = 'TEST.IN';
/* Second parameter: Queue Type. */
SET refRequest.Parameter[2] = MQIA_Q_TYPE;
SET refRequest.Parameter[2].* = MQQT_LOCAL ;
/* Third parameter: Allow/Inhibit GET.*/
SET refRequest.Parameter[3] = MQIA_INHIBIT_GET;
SET refRequest.Parameter[3].* = MQQA_GET_INHIBITED;
SET OutputRoot.BLOB.BLOB = asbitstream(OutputRoot.MQPCF);
SET OutputRoot.MQPCF = null;
SET OutputRoot.MQMD.Format = MQFMT_ADMIN;
You don't seem to understand how IIB works. You specify the QM by how you set up your message flow output node.
You use ESQL only to build the PCF message. You should look into the MQCFH parser.
Then you send that message in your message flow via an MQ Output node pointed to the QM and the SYSTEM.ADMIN.COMMAND.QUEUE queue there.
Your code seems wrong only as it converts to BLOB, which is not necessary, and it doesn't set some header values. Check this link for more detailed examples: https://www.ibm.com/support/knowledgecenter/en/SSMKHH_10.0.0/com.ibm.etools.mft.doc/ac16915_.html
I believe this code should work for building the command message, but I cannot try it now:
CREATE NEXTSIBLING OF OutputRoot.Properties DOMAIN 'MQMD';
CREATE NEXTSIBLING OF OutputRoot.MQMD DOMAIN 'MQADMIN'
NAME 'MQPCF';
DECLARE refRequest REFERENCE TO OutputRoot.MQPCF;
SET OutputRoot.MQMD.MsgType = MQMT_REQUEST;
SET OutputRoot.MQMD.ReplyToQ = 'REPLYQ';
SET refRequest.Type = MQCFT_COMMAND;
SET refRequest.StrucLength = MQCFH_STRUC_LENGTH;
SET refRequest.Version = MQCFH_CURRENT_VERSION;
SET refRequest.Command = MQCMD_CHANGE_Q;
SET refRequest.MsgSeqNumber = 1;
SET refRequest.Control = MQCFC_LAST;
SET refRequest.Parameter[1] = MQCA_Q_NAME;
SET refRequest.Parameter[1].* = ‘QYOUWANTTOINHIBIT’;
SET refRequest.Parameter[2] = MQIA_Q_TYPE;
SET refRequest.Parameter[2].* = MQQT_LOCAL;
SET refRequest.Parameter[3] = MQIA_INHIBIT_GET;
SET refRequest.Parameter[3].* = MQQA_GET_INHIBITED;
RETURN TRUE;