|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
MQGET in VB6 |
« View previous topic :: View next topic » |
Author |
Message
|
Juca Peba |
Posted: Thu Jun 05, 2008 6:38 pm Post subject: MQGET in VB6 |
|
|
Newbie
Joined: 05 Jun 2008 Posts: 7
|
I have a problem with MQGET function in VB6...
I'm trying to get a message from a MQSeries 6.0 with a string buffer... But, when I call the function passing a string buffer of 2MB, the program stops responding.
Does anybody know how to solve problem?
Best regards. |
|
Back to top |
|
 |
dkeister |
Posted: Fri Jun 06, 2008 7:38 am Post subject: |
|
|
Disciple
Joined: 25 Mar 2002 Posts: 184 Location: Purchase, New York
|
You've got to provide more details if you want help. Things like which program stops responding, your VB application? MQ? What was the return code from the get? _________________ Dean Keister |
|
Back to top |
|
 |
bruce2359 |
Posted: Fri Jun 06, 2008 10:04 am Post subject: |
|
|
 Poobah
Joined: 05 Jan 2008 Posts: 9471 Location: US: west coast, almost. Otherwise, enroute.
|
Also, any messages written to error logs for your qmgr? _________________ I like deadlines. I like to wave as they pass by.
ב''ה
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live. |
|
Back to top |
|
 |
Juca Peba |
Posted: Fri Jun 06, 2008 10:57 am Post subject: |
|
|
Newbie
Joined: 05 Jun 2008 Posts: 7
|
My VB application stops responding... And there isn't a return code because my VB application gets stuck in the line of MQGET function call. |
|
Back to top |
|
 |
bruce2359 |
Posted: Fri Jun 06, 2008 11:10 am Post subject: |
|
|
 Poobah
Joined: 05 Jan 2008 Posts: 9471 Location: US: west coast, almost. Otherwise, enroute.
|
Quote: |
any messages written to error logs for your qmgr? |
_________________ I like deadlines. I like to wave as they pass by.
ב''ה
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live. |
|
Back to top |
|
 |
Juca Peba |
Posted: Fri Jun 06, 2008 11:48 am Post subject: |
|
|
Newbie
Joined: 05 Jun 2008 Posts: 7
|
There's a log message:
TCP/IP (recv) return code 10054 (X'2746') - It's possible to be a communication failure.
But, this message appears only thereafter I close my VB application using the task manager.... I think that this event occurs because I close the VB application without disconnecting of MQSeries. |
|
Back to top |
|
 |
bruce2359 |
Posted: Fri Jun 06, 2008 12:26 pm Post subject: |
|
|
 Poobah
Joined: 05 Jan 2008 Posts: 9471 Location: US: west coast, almost. Otherwise, enroute.
|
Quote: |
I'm trying to get a message from a MQSeries 6.0 with a string buffer... |
You are also expecting the MQMD, yes? And you have included the MQMD structure?
Copy/paste your vb code here. _________________ I like deadlines. I like to wave as they pass by.
ב''ה
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live. |
|
Back to top |
|
 |
Juca Peba |
Posted: Fri Jun 06, 2008 2:47 pm Post subject: |
|
|
Newbie
Joined: 05 Jun 2008 Posts: 7
|
My code (it stops responding in the highlighted line):
Dim CompCode As Long
Dim ReasonCode As Long
Dim hConn As Long
Dim odQueue As MQOD
Dim hObjQueue As Long
Dim gmoOpt As MQGMO
Dim mdData As MQMD
Dim Buffer As String * 1000
MQ_SETDEFAULTS
MQCONN "", hConn, CompCode, ReasonCode
If hConn <> 0 Then
MQOD_DEFAULTS odQueue
odQueue.ObjectName = MyQueueName
MQOPEN hConn, odQueue, MQOO_OUTPUT + MQOO_INPUT_SHARED, hObjQueue, CompCode, ReasonCode
If CompCode = MQCC_OK Then
MQGMO_DEFAULTS gmoOpt
gmoOpt.Options = MQGMO_WAIT
gmoOpt.WaitInterval = 5000
MQMD_DEFAULTS mdData
MQGET hConn, hObjQueue, mdData, gmoOpt, Len(Buffer), Buffer, 0, CompCode, ReasonCode
MQCLOSE hConn, hObjQueue, 0, CompCode, ReasonCode
End If
MQDISC hConn, CompCode, ReasonCode
End If
|
|
Back to top |
|
 |
bruce2359 |
Posted: Fri Jun 06, 2008 5:58 pm Post subject: |
|
|
 Poobah
Joined: 05 Jan 2008 Posts: 9471 Location: US: west coast, almost. Otherwise, enroute.
|
From the WMQ Application Programing manual:
Visual Basic invocation:
MQGET Hconn, Hobj, MsgDesc, GetMsgOpts, BufferLength, Buffer, DataLength, CompCode, Reason
DataLength is an output field from the qmgr to your program. DataLength will contain the actual length of the message in the queue.
Add this: Dim DataLength As Long ’Length of the message’
Change your MQGET:
MQGET hConn, hObjQueue, mdData, gmoOpt, Len(Buffer), Buffer, DataLength, CompCode, ReasonCode
I don't have VB installed, so I can't test... _________________ I like deadlines. I like to wave as they pass by.
ב''ה
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live. |
|
Back to top |
|
 |
Juca Peba |
Posted: Tue Jun 10, 2008 11:04 am Post subject: |
|
|
Newbie
Joined: 05 Jun 2008 Posts: 7
|
Even so, the VB application continues with the same error. |
|
Back to top |
|
 |
bruce2359 |
Posted: Tue Jun 10, 2008 11:45 am Post subject: |
|
|
 Poobah
Joined: 05 Jan 2008 Posts: 9471 Location: US: west coast, almost. Otherwise, enroute.
|
Quote: |
application gets stuck in the line of MQGET function call |
How do you know this?
Looking at your MQCONN code... following each MQ call, you need to look at CompletionCode and ReasonCode to determine if the call succeeded. A non-zero handle is not sufficient.
The WMQ APR manual syntax for MQOPEN:
MQOPEN (Hconn, ObjDesc, Options, Hobj, CompCode, Reason)
Your code doesn't specify an Options field.
MQOPEN hConn, odQueue, MQOO_OUTPUT + MQOO_INPUT_SHARED, hObjQueue, CompCode, ReasonCode
There are lots of MQ code examples supplied with the product and available online from lots of sources. Please look at some of the examples. _________________ I like deadlines. I like to wave as they pass by.
ב''ה
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live. |
|
Back to top |
|
 |
Juca Peba |
Posted: Wed Jun 11, 2008 12:59 pm Post subject: |
|
|
Newbie
Joined: 05 Jun 2008 Posts: 7
|
I found somebody who had the same problem in other forum (http://fixunix.com/websphere/212225-error-mqget-vb6.html) and he used the cmqb.bas from V5.2...
Has anybody the VB module CMQB.BAS from version 5.2 of MQSeries? |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Jun 11, 2008 1:03 pm Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Okay, NEVER EVER EVER use an OLDER version of code.
Especially a v5.2 version.
EVER.
I have to say that I think you do not understand what the WAIT interval that you are setting is doing, and where you "think" your code is "hanging", in fact it is "waiting" until either the Wait interval shows up OR until a message that matches what you are asking to match shows up - which ever comes first.
Thirdly, you shouldn't be using VB6 at all. It's only slightly less deprecated than MQ v5.2. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
Juca Peba |
Posted: Thu Jun 12, 2008 6:04 am Post subject: |
|
|
Newbie
Joined: 05 Jun 2008 Posts: 7
|
It isn't WAITING for a message... With WaitInterval = 5000, it should wait for only 5 seconds... And it's waiting FOREVER!!! |
|
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
|
|
|
|