| Author | Message | 
		
		  | bobbee | 
			  
				|  Posted: Wed Mar 22, 2023 8:14 am    Post subject: PYMQI CONN_ID |   |  | 
		
		  |  Knight
 
 
 Joined: 20 Sep 2001Posts: 546
 Location: Tampa
 
 | 
			  
				| I issue an INQUIRE_CONN, I am filtering the CONNs, when I fiind the one I am looking for, I save off the conn_id into conn_id, I then issue the following (I am looking for the list of Object Names associated with this CONN_ID): 
 
 
   
	| Code: |  
	| conn__handle_response=pcf.MQCMD_INQUIRE_CONNECTION({pymqi.CMQCFC.MQBACF_CONNECTION_ID:conn_id, pymqi.CMQCFC.MQIACF_CONN_INFO_TYPE:pymqi.CMQCFC.MQIACF_CONN_INFO_HANDLE,pymqi.CMQCFC.MQIACF_CONNECTION_ATTRS:pymqi.CMQCFC.MQIACF_ALL})
 |  
 I get not found.
 
 If I replace conn-id with pymqi.ByteString('') I get all the handles. Buried in the list is the handle I am looking for with the conn-id I wold have specified. Is there some translation I am missing? Here is the PRINT of the returned conn-id value.
 
 7006: b'AMQCBOBBEE      \xfdb\x02d\x01\x1e[!',
 
 I did a length on this and it is 24
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | fjb_saper | 
			  
				|  Posted: Thu Mar 23, 2023 6:48 am    Post subject: |   |  | 
		
		  |  Grand High Poobah
 
 
 Joined: 18 Nov 2003Posts: 20767
 Location: LI,NY
 
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | bobbee | 
			  
				|  Posted: Thu Mar 23, 2023 7:07 am    Post subject: |   |  | 
		
		  |  Knight
 
 
 Joined: 20 Sep 2001Posts: 546
 Location: Tampa
 
 | 
			  
				| I was trying to use the CONN_ID so I could then issue a INQ_CONN (handle) to get to the specific queues opened for that CONN_ID. For the life of me I could not get it to work. 
 So I asked for ALL the handles (messy) converted the conn_id to string and just used an 'if' statement looking for a match.The customer I gave this to has 7k+ connections. I do limit the HANDLE query to only connections that exceed a certain LUW in seconds.
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | hughson | 
			  
				|  Posted: Thu Mar 23, 2023 4:26 pm    Post subject: Re: PYMQI CONN_ID |   |  | 
		
		  |  Padawan
 
 
 Joined: 09 May 2013Posts: 1967
 Location: Bay of Plenty, New Zealand
 
 | 
			  
				| 
   
	| bobbee wrote: |  
	| I issue an INQUIRE_CONN, I am filtering the CONNs, when I fiind the one I am looking for, I save off the conn_id into conn_id, I then issue the following (I am looking for the list of Object Names associated with this CONN_ID): 
 
 
   
	| Code: |  
	| conn__handle_response=pcf.MQCMD_INQUIRE_CONNECTION({pymqi.CMQCFC.MQBACF_CONNECTION_ID:conn_id, pymqi.CMQCFC.MQIACF_CONN_INFO_TYPE:pymqi.CMQCFC.MQIACF_CONN_INFO_HANDLE,pymqi.CMQCFC.MQIACF_CONNECTION_ATTRS:pymqi.CMQCFC.MQIACF_ALL})
 |  |  
 I've found that using this:-
 
 
 
   
	| Code: |  
	| args = {pymqi.CMQCFC.MQBACF_CONNECTION_ID: conn_id, pymqi.CMQCFC.MQIACF_CONNECTION_ATTRS: [pymqi.CMQCFC.MQIACF_ALL]}
 response = pcf.MQCMD_INQUIRE_CONNECTION(args)
 |  
 does not work, but using this:-
 
 
 
   
	| Code: |  
	| args= [] args.append(pymqi.CFBS(Parameter=pymqi.CMQCFC.MQBACF_CONNECTION_ID,String=conn_id))
 args.append(pymqi.CFIL(Parameter=pymqi.CMQCFC.MQIACF_CONNECTION_ATTRS,Values=[pymqi.CMQCFC.MQIACF_ALL]))
 response = pcf.MQCMD_INQUIRE_CONNECTION(args)
 |  
 does. And yet they should be equivalent. This suggests a defect in PyMQI where it is not treating the MQBACF_CONNECTION_ID as a CFBS. When you force it to be a CFBS it works.
 
 Cheers,
 Morag
 _________________
 Morag Hughson @MoragHughson
 IBM MQ Technical Education Specialist
 Get your IBM MQ training here!
 MQGem Software
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | bobbee | 
			  
				|  Posted: Mon Apr 03, 2023 1:39 pm    Post subject: |   |  | 
		
		  |  Knight
 
 
 Joined: 20 Sep 2001Posts: 546
 Location: Tampa
 
 | 
			  
				| I did try you solution: 
 
 
   
	| Code: |  
	| args= [] args.append(pymqi.CFBS(Parameter=pymqi.CMQCFC.MQBACF_CONNECTION_ID,String=conn_id))
 args.append(pymqi.CFIL(Parameter=pymqi.CMQCFC.MQIACF_CONN_INFO_TYPE,Values=[pymqi.CMQCFC.MQIACF_CONN_INFO_HANDLE]))
 args.append(pymqi.CFIL(Parameter=pymqi.CMQCFC.MQIACF_CONNECTION_ATTRS,Values=[pymqi.CMQCFC.MQIACF_ALL]))
 try:
 conn_handle_response=pcf.MQCMD_INQUIRE_CONNECTION(args)
 |  
 It REALLY does not like the value I got returned for Conn_id!!!!!!!!!
 
 
 
   
	| Code: |  
	| [mqm@fibbing1 scripts]$ python3 ./conn_luw.py  conn_luw.config.properties Queue Manager =  BOBBEE
 <class 'float'>
 Traceback (most recent call last):
 File "./conn_luw.py", line 485, in <module>
 if conn_check(QueueMGR):
 File "./conn_luw.py", line 187, in conn_check
 conn_handle_response=pcf.MQCMD_INQUIRE_CONNECTION(args)
 File "/usr/local/lib64/python3.6/site-packages/pymqi-1.12.0-py3.6-linux-x86_64.egg/pymqi/__init__.py", line 2723, in __call__
 message = message + parameter.pack()
 File "/usr/local/lib64/python3.6/site-packages/pymqi-1.12.0-py3.6-linux-x86_64.egg/pymqi/__init__.py", line 309, in pack
 ensure_not_unicode(v)  # Python 3 bytes check
 File "/usr/local/lib64/python3.6/site-packages/pymqi-1.12.0-py3.6-linux-x86_64.egg/pymqi/__init__.py", line 177, in ensure_not_unicode
 raise TypeError(msg.format(value))
 TypeError: Python 3 style string (unicode) found but not allowed here: `b'AMQCBOBBEE      \xfdb\x02d\x01>\x8a!'`. Convert to bytes.
 |  |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | hughson | 
			  
				|  Posted: Mon Apr 03, 2023 1:50 pm    Post subject: |   |  | 
		
		  |  Padawan
 
 
 Joined: 09 May 2013Posts: 1967
 Location: Bay of Plenty, New Zealand
 
 | 
			  
				| Can you show us your code that sets the value of conn_id please? Is it bytes if you print out its type? 
 Cheers,
 Morag
 _________________
 Morag Hughson @MoragHughson
 IBM MQ Technical Education Specialist
 Get your IBM MQ training here!
 MQGem Software
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | bobbee | 
			  
				|  Posted: Mon Apr 03, 2023 3:46 pm    Post subject: |   |  | 
		
		  |  Knight
 
 
 Joined: 20 Sep 2001Posts: 546
 Location: Tampa
 
 | 
			  
				| conn_id = str(conn_info[pymqi.CMQCFC.MQBACF_CONNECTION_ID]) |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | hughson | 
			  
				|  Posted: Mon Apr 03, 2023 3:49 pm    Post subject: |   |  | 
		
		  |  Padawan
 
 
 Joined: 09 May 2013Posts: 1967
 Location: Bay of Plenty, New Zealand
 
 | 
			  
				| 
   
	| bobbee wrote: |  
	| conn_id = str(conn_info[pymqi.CMQCFC.MQBACF_CONNECTION_ID]) |  
 Don't turn it into a string - it's a bytes field.
 
 The error even tells you that!
   
 
 
   
	| Code: |  
	| TypeError: Python 3 style string (unicode) found but not allowed here: `b'AMQCBOBBEE      \xfdb\x02d\x01>\x8a!'`. Convert to bytes. |  
 My code just has:-
 
 
   
	| Code: |  
	| conn_id = conn_info[pymqi.CMQCFC.MQBACF_CONNECTION_ID] |  
 Try it like that and see how you get on.
 
 Cheers,
 Morag
 _________________
 Morag Hughson @MoragHughson
 IBM MQ Technical Education Specialist
 Get your IBM MQ training here!
 MQGem Software
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | bobbee | 
			  
				|  Posted: Mon Apr 03, 2023 3:51 pm    Post subject: |   |  | 
		
		  |  Knight
 
 
 Joined: 20 Sep 2001Posts: 546
 Location: Tampa
 
 | 
			  
				| Let me reset that, I was changing all sorts of things trying to get it to work. Missed resetting that. |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | bobbee | 
			  
				|  Posted: Tue Apr 04, 2023 6:23 am    Post subject: |   |  | 
		
		  |  Knight
 
 
 Joined: 20 Sep 2001Posts: 546
 Location: Tampa
 
 | 
			  
				| Thanks M for catching my issue. That part of the code is working. |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | hughson | 
			  
				|  Posted: Tue Apr 04, 2023 9:00 pm    Post subject: |   |  | 
		
		  |  Padawan
 
 
 Joined: 09 May 2013Posts: 1967
 Location: Bay of Plenty, New Zealand
 
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  |  |