Specify string filter for inquire command

Asked by Rik Baeten

I have difficulties constructing a string filter. Can you please assist me? Thanks.

I want to do a similar PCF call as in:
<runmqsc>
dis qalias(*) where (targq EQ "QL.BANANAS")
</runmqsc>

For this I will probably need to code something like this:
<code>
pcfQmgr=queueManager.getConnectedPcfQueueManager()
res=pcfQmgr.MQCMD_INQUIRE_Q({MQCA_Q_NAME :'*',
                                                      MQIA_Q_TYPE : MQQT_ALIAS,
                                                      MQIACF_Q_ATTRS : MQCA_Q_NAME,
                                                      MQCFT_STRING_FILTER : MQCA_BASE_Q_NAME MQCFOP_EQUAL "QL.BANANAS"})
</code>

Question information

Language:
English Edit question
Status:
Solved
For:
PyMQI Edit question
Assignee:
Dariusz Suchojad Edit question
Solved by:
Rik Baeten
Solved:
Last query:
Last reply:
Revision history for this message
Dariusz Suchojad (dsuch) said :
#1

Hi Rik, many thanks for yet another interesting issue! :-)

I'll see to it now but in the meantime I was wondering if you perhaps wanted to let me know what your e-mail address is. That way I could send you tarballs with branches when they're needed so that you don't have any problems with proxy not being able to cope with HTTPS like you mentioned in the other question. Ideally, I'll try to come up with something else but for the time being, that would do.

Revision history for this message
Dariusz Suchojad (dsuch) said :
#2

OK, as things stand now, there is no way to achieve it directly as you'd like to. That's because pymqe doesn't support string nor integer filters at all. I know how to add it but unfortunately I probably won't be able to do it this month. Can it wait till April?

As a workaround, you can use the code below and filter what you need out on Python side. I know it's not that good a workaround but it works OK and in the absence of true filters - it's the only thing I can recommend.

import pymqi, CMQC, CMQCFC

queue_manager = "QM01"
channel = "SVRCONN.1"
host = "192.168.1.126"
port = "1418"
conn_info = "%s(%s)" % (host, port)

qmgr = pymqi.connect(queue_manager, channel, conn_info)
pcf = pymqi.PCFExecute(qmgr)

cfsf = pymqi.CFSF()

res = pcf.MQCMD_INQUIRE_Q({CMQC.MQCA_Q_NAME :'*', CMQC.MQIA_Q_TYPE : CMQC.MQQT_ALIAS,
                             CMQCFC.MQIACF_Q_ATTRS : CMQCFC.MQIACF_ALL,
                             })
print(res)

qmgr.disconnect()

$ python pymqi-q-149408.py
[{2016L: 'ALIAS.1 ', 96L: 0L, 45L: 1L, 5L: 0L, 6L: 0L, 193L: 1L, 9L: 0L, 10L: 0L, 2027L: '2011-03-17 ', 2028L: '18.01.12', 2029L: ' ', 2030L: ' ', 2013L: ' ', 2002L: 'TEST.1 ', 20L: 3L, 184L: 1L, 188L: 0L, 61L: 0L, 190L: 0L, 95L: 0L}, {2016L: 'SYSTEM.DEFAULT.ALIAS.QUEUE ', 96L: 0L, 45L: 1L, 5L: 0L, 6L: 0L, 193L: 1L, 9L: 0L, 10L: 0L, 2027L: '2010-07-08 ', 2028L: '21.14.04', 2029L: ' ', 2030L: ' ', 2013L: ' ', 2002L: ' ', 20L: 3L, 184L: 1L, 188L: 0L, 61L: 0L, 190L: 0L, 95L: 0L}]
$

Revision history for this message
Rik Baeten (rik-baeten) said :
#3

Ok, thanks. I'll wait for the filter implementation then.

But like you suggested, for the moment I will fetch all queue names and then inside Python I will filter out the necessary aliases.

Should I mark the problem as solved now?

Revision history for this message
Rik Baeten (rik-baeten) said :
#4

Solved (see related bug report). Thanks very much!