ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » General IBM MQ Support » pyqi channel type

Post new topic  Reply to topic
 pyqi channel type « View previous topic :: View next topic » 
Author Message
bobbee
PostPosted: Mon Apr 11, 2022 9:54 am    Post subject: pyqi channel type Reply with quote

Knight

Joined: 20 Sep 2001
Posts: 541
Location: Tampa

I have the following lines of code.

Code:
 channel_type = channel_info[pymqi.CMQCFC.MQIACH_CHANNEL_TYPE]
                print('Channel type = ', type(channel_type))



How do I do a lookup to get the string value for the returned channel type INT?
Back to top
View user's profile Send private message Send e-mail AIM Address
gbaddeley
PostPosted: Mon Apr 11, 2022 3:21 pm    Post subject: Reply with quote

Jedi

Joined: 25 Mar 2003
Posts: 2494
Location: Melbourne, Australia

In C/C++, the header file cmqstrc.h contains functions for converting a multitude of MQ constants to their string names. MQCHT_STR returns the channel type string. I don't know if this is available for Phython. You may need to copy the code into your type() function.
_________________
Glenn
Back to top
View user's profile Send private message
hughson
PostPosted: Mon Apr 11, 2022 10:29 pm    Post subject: Reply with quote

Padawan

Joined: 09 May 2013
Posts: 1914
Location: Bay of Plenty, New Zealand

You should do something like this. You might need some extra import statements at the top of your program for this to work, but this was good for me.

Code:
d = _MQConst2String(CMQXC, 'MQCHT_')
if channel_type in d:
  print('Channel type = ', d[channel_type])
else:
  print('Channel type = ', channel_type)

Cheers,
Morag
_________________
Morag Hughson @MoragHughson
IBM MQ Technical Education Specialist
Get your IBM MQ training here!
MQGem Software
Back to top
View user's profile Send private message Visit poster's website
bobbee
PostPosted: Tue Apr 12, 2022 4:12 am    Post subject: Reply with quote

Knight

Joined: 20 Sep 2001
Posts: 541
Location: Tampa

I found a sample using _MQConst2String, that is what I was looking for. I am assuming it is buried in pymqe. My import for that does not work. Trying to figure it out. Linux environment.

Code:
try:
    from . import pymqe # type: ignore
except ImportError:
    import pymqe # type: ignore # Backward compatibility


UPDATE:
Interesting I see the code in GITHUB. pymqi/code/pymqi/__init__.py. Don't know why I am not getting to it. I am at PYTHON3 v3.8

Code:
[mqm@fibbing1 scripts]$ python3 --version
Python 3.6.8
Back to top
View user's profile Send private message Send e-mail AIM Address
bobbee
PostPosted: Tue Apr 12, 2022 6:58 am    Post subject: Reply with quote

Knight

Joined: 20 Sep 2001
Posts: 541
Location: Tampa

Thank you Morag, again!! That line was what I was looking for. Little modification and it worked!!!

d - pymqi._MQConst2String(CMQXC, 'MQCHT_')

Needed a little direction!!!
Back to top
View user's profile Send private message Send e-mail AIM Address
hughson
PostPosted: Tue Apr 12, 2022 3:09 pm    Post subject: Reply with quote

Padawan

Joined: 09 May 2013
Posts: 1914
Location: Bay of Plenty, New Zealand

I have an import statement at top of my file thus:-

Code:
from pymqi import _MQConst2String


which is what makes my line work.

Without that import statement you need to fully qualify the line as you have. And P.S. you need an equal sign!

Code:
d = pymqi._MQConst2String(CMQXC, 'MQCHT_')


Cheers,
Morag
_________________
Morag Hughson @MoragHughson
IBM MQ Technical Education Specialist
Get your IBM MQ training here!
MQGem Software
Back to top
View user's profile Send private message Visit poster's website
bobbee
PostPosted: Wed Apr 13, 2022 2:42 am    Post subject: Reply with quote

Knight

Joined: 20 Sep 2001
Posts: 541
Location: Tampa

It's these little things that make one's day sunny.

I looked and looked and did not see examples and the the 'pymqi' full qualification hit me. I actually thought at one time I did try an IMPORT like that. Must have had it slightly different. I will adjust the code. Thanks from the peanut gallery!!

I am writing a MQ Healthcheck/Hardening script at someone's request. It is actually an interesting script.
Back to top
View user's profile Send private message Send e-mail AIM Address
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » General IBM MQ Support » pyqi channel type
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.