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 IndexIBM MQ API SupportQuery current Qmgr name

Post new topicReply to topic
Query current Qmgr name View previous topic :: View next topic
Author Message
fswarbrick
PostPosted: Sun May 03, 2020 8:49 pm Post subject: Query current Qmgr name Reply with quote

Apprentice

Joined: 07 Jul 2014
Posts: 38

So when you use the MQSERVER environment variable you don't actually supply the name of the queue manager. After I connect to it using MQCONN or MQCONNX, is there a way to query on the name of the queue manager I am connected to?
Back to top
View user's profile Send private message
PaulClarke
PostPosted: Sun May 03, 2020 11:20 pm Post subject: Reply with quote

Guardian

Joined: 17 Nov 2005
Posts: 977
Location: New Zealand

Yes you can do that using the MQINQ verb.

Regards,
Paul.
_________________
Paul Clarke
MQGem Software
www.mqgem.com
Back to top
View user's profile Send private message Visit poster's website
fswarbrick
PostPosted: Mon May 04, 2020 2:52 pm Post subject: Reply with quote

Apprentice

Joined: 07 Jul 2014
Posts: 38

I see how you can connect to a queue manager than then use MQINQ to get information about that queue manager. But its not clear to me how I can utilize this to retrieve information about the "unnamed" queue manager I am currently connected to. What am I missing?
Back to top
View user's profile Send private message
fswarbrick
PostPosted: Mon May 04, 2020 3:31 pm Post subject: Reply with quote

Apprentice

Joined: 07 Jul 2014
Posts: 38

As so often happens, after I make the request for help the answer comes to me. Looks like for a Q_MGR object you don't have to supply the object name, and it will use the name from your current connection. Works like a charm.

In case anyone in the future is interested, here is my code. Written in Go (!!!) but should be simple enough to translate to your preferred language.

Code:
import mq "github.com/ibm-messaging/mq-golang/ibmmq"

func queryqmgr(qMgr mq.MQQueueManager) {
    mqod := mq.NewMQOD()
    mqod.ObjectType = mq.MQOT_Q_MGR

    qObject, err := qMgr.Open(mqod, mq.MQOO_FAIL_IF_QUIESCING|mq.MQOO_INQUIRE)
    if err != nil {
        log.Panic(err)
    }
    reply, err := qObject.Inq([]int32{mq.MQCA_Q_MGR_NAME})
    if err != nil {
        log.Panic(err)
    }
    log.Printf("Connected to %v\n", reply[mq.MQCA_Q_MGR_NAME])
}
Back to top
View user's profile Send private message
PaulClarke
PostPosted: Mon May 04, 2020 5:01 pm Post subject: Reply with quote

Guardian

Joined: 17 Nov 2005
Posts: 977
Location: New Zealand

Or, put another way, I told you the answer
_________________
Paul Clarke
MQGem Software
www.mqgem.com
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:
Post new topicReply to topic Page 1 of 1

MQSeries.net Forum IndexIBM MQ API SupportQuery current Qmgr name
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.