|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Looking for VB code using MQCONNX MQCNO MQCD - Please help |
« View previous topic :: View next topic » |
Author |
Message
|
vaibhav_sarpotdar |
Posted: Fri Jun 21, 2002 12:21 pm Post subject: Looking for VB code using MQCONNX MQCNO MQCD - Please help |
|
|
Newbie
Joined: 21 Jun 2002 Posts: 1
|
I'm writing a VB6 program, based on the amqput VB5 sample, which should be able to connect to
different MQ servers dynamically. To achieve this, I'm using the MQCONNX call with the MQCNO and
MQCD structures. For some reason I can't seem to get it working. Accoording to the manuals, the
MQCNO udt has a ClientConnPtr variable which must points to the MQCD structure. To achieve this I've
tried several methods, all of which failed. Varptr(cd), StrPtr(cd.ChannelName), CopyMemory call etc.
I've also tried to combine both udt's to one single udt and setting the ClientConnOffset, which also
didn't work. And finally I changed the MQCNO udt so it had an additional variable of the MQCD type.
I think the last method is the way to go, but again no luck. The C sample pogram amqscxcn, which is
similar to what I'm trying to achieve, works like a charm. Alas, my client won't accept any programs
written in C.
So, what I'm looking for is a VB code snippet which shows the correct way to dynamically connect to
an MQ server. Please include any modified udts and api calls.
Thank you very much for the assistence,
Vaibhav Sarpotdar |
|
Back to top |
|
 |
osfitch |
Posted: Wed Sep 25, 2002 5:19 pm Post subject: |
|
|
Newbie
Joined: 25 May 2001 Posts: 5
|
In VB it is easier to use the MQCONNXAny than the MQCONNX.
MQCONNXAny uses the MQCNOCD structure which combines both
the MQCNO and MQCD. The MQCNOCD also takes care of setting
the ClientConnPtr and ClientConnOffset variables for you.
Try the following code to connect a client to a remote queue manager:
Dim co As MQCNOCD
Dim CompCode As Long ' Completion code
Dim Reason As Long ' Reason code
Dim gHcon As Long ' Connection handle
MQCNOCD_DEFAULTS co
co.ConnectOpts.Options = MQCNO_NONE
co.ChannelDef.ChannelName = "SYSTEM.DEF.SVRCONN"
co.ChannelDef.ConnectionName = "127.0.0.1(1414)" ' Or whatever connection name you need
MQCONNXAny "<QMgrName>", co, gHcon, CompCode, Reason ' Replace <QMgrName> by the queue manager you want connect to
Also for a client connection make sure you specify MqType = 2 in the Project Properties.
Hope this helps!
Oliver Fisse
IBM National MQSeries Practice |
|
Back to top |
|
 |
Jean |
Posted: Mon Jan 06, 2003 10:09 am Post subject: |
|
|
Newbie
Joined: 20 Dec 2002 Posts: 3
|
Hello!
What if I must use MQCONNX and cannot use MQCONNXAny??
Could you please help me setting the correct ClientConnOffset value?
Thank you! |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
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
|
|
|
|