Author |
Message
|
fswarbrick |
Posted: Sun May 03, 2020 8:49 pm Post subject: Query current Qmgr name |
|
|
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 |
|
 |
PaulClarke |
Posted: Sun May 03, 2020 11:20 pm Post subject: |
|
|
 Guardian
Joined: 17 Nov 2005 Posts: 981 Location: New Zealand
|
Yes you can do that using the MQINQ verb.
Regards,
Paul. _________________ Paul Clarke
MQGem Software
www.mqgem.com |
|
Back to top |
|
 |
fswarbrick |
Posted: Mon May 04, 2020 2:52 pm Post subject: |
|
|
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 |
|
 |
fswarbrick |
Posted: Mon May 04, 2020 3:31 pm Post subject: |
|
|
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 |
|
 |
PaulClarke |
Posted: Mon May 04, 2020 5:01 pm Post subject: |
|
|
 Guardian
Joined: 17 Nov 2005 Posts: 981 Location: New Zealand
|
Or, put another way, I told you the answer  _________________ Paul Clarke
MQGem Software
www.mqgem.com |
|
Back to top |
|
 |
|