MQCMD_INQUIRE_CONNECTION returns MQRC_PARAMETER_MISSING

Asked by Rik Baeten

I'm trying to execute the MQCMD_INQUIRE_CONNECTION command, but this seems to always return MQRC_PARAMETER_MISSING.

import pymqi
from CMQC import *
from CMQCFC import *
cd = pymqi.cd()
cd.ChannelName = 'SYSTEM.DEF.SVRCONN'
cd.ConnectionName = 'myhost(1414)'
cd.ChannelType = MQCHT_CLNTCONN
cd.TransportType = MQXPT_TCP
qmgr = pymqi.QueueManager(None)
qmgr.connectWithOptions('MYQM', opts=MQCNO_HANDLE_SHARE_NO_BLOCK, cd=cd)
pcf=pymqi.PCFExecute(qmgr)
conns=pcf.MQCMD_INQUIRE_CONNECTION({MQBACF_GENERIC_CONNECTION_ID:'',MQIACF_CONNECTION_ATTRS:MQIACF_ALL})

The PCF manual mentions that the only required parameter is either MQBACF_CONNECTION_ID or MQBACF_GENERIC_CONNECTION_ID. I'm not really 100% sure if this is related to the pymqi library itself, but since I'm following the book there might be an issue here. The manual mentions you should "specify a byte string of zero length, or one which contains only null bytes". Is it possible this is not foreseen in the pymqe casts from Python string to C char*?

I have observed the client WMQ library is returning the rc, not the server.

I have the impression the WMQ Explorer itself uses at least the following parameters, but this returns the same rc via pymqi:

conns=pcf.MQCMD_INQUIRE_CONNECTION({MQBACF_GENERIC_CONNECTION_ID:"",MQIACF_CONNECTION_ATTRS:MQIACF_ALL,MQIACF_CONN_INFO_TYPE:MQIACF_CONN_INFO_CONN})

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 there,

on the face of it, it looks just fine and your code should work out of the box. The docs are indeed a bit murky and given that I've never used that particular PCF call, I can't guarantee it's not something on PyMQI's side. I'm digging into it, hoping I'll be able to shed some light on it soon.

Cheers!

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

OK, I know what it is. Like you mentioned, IBM decided MQBACF_GENERIC_CONNECTION_ID should be a 'byte string' instead of a simple string and apparently same goes for the values MQCMD_INQUIRE_CONNECTION returns. The problem is, pymqe doesn't support byte strings right now. I've made some quick & crude changes to pymqe here locally and at least it doesn't complain about a missing parameter anymore. So it can be done and I think I know how it should be done.

My question now is, when do you need to have it ready? It will be a slightly bigger change and should definitely go into PyMQI 1.2. I was hoping bugs #671056 and #672169 would be what goes into 1.2 but I'm not sure if waiting for it is OK with you. Would you prefer waiting for 1.2 or are you OK with applying patches I'll be preparing and recompiling PyMQI in your environment? My take is PyMQI 1.2 will be released in a month or so, maybe a bit later.

In any case, I'll open a bug report regarding byte strings soon and will post its number here so that you can subscribe to it and watch it progressing.

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

Thank you very much for the quick response!

I've downloaded the bzr branch and built it. It's perfectly working now as indicated in the example of the bug report.

At this moment I'm ok with using the patched version in test. I will wait for 1.2 before going to production.