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 » IBM MQ API Support » Unable to put message with VB.NET and MQAX

Post new topic  Reply to topic
 Unable to put message with VB.NET and MQAX « View previous topic :: View next topic » 
Author Message
smkwan
PostPosted: Sun Jun 23, 2002 9:15 pm    Post subject: Unable to put message with VB.NET and MQAX Reply with quote

Newbie

Joined: 19 Jun 2002
Posts: 2

Hello, I'm new to both VB .NET and MQseries but anyway I need to write a program to get some info to and from MQ. I've trouble to send message out by MQ.

In my case I got two queue, one support send me some info and then after process I put the result into the out queue and send it out.

The following segment of program illustrated how I put the message to MQ. The program work when I put some string data to the input queue "IBMMSG.RTOW.MTELEX.QL" but it fail if I select to put the data in the output queue "RTOW.IBMMSG.MTELEX.QR". In both case the reason code and completion code are both zero but the server people told me that they got error message from the output queue that the client try to connect to the queue but failed.


Private Sub Put_Queue(ByVal InOut As Short, ByVal OutStr As String)

Dim MQSess As MQAX200.MQSession '* session object
Dim QMgr As MQAX200.MQQueueManager '* queue manager object
Dim Queue As MQAX200.MQQueue '* queue object
Dim PutMsg As MQAX200.MQMessage '* message object for put
Dim PutOptions As MQAX200.MQPutMessageOptions '* put message options
Dim PutMsgStr As String '* put message data string

Dim MQCHLTAB, APIO_ORIGINATOR, APIO_MSG_RCPT, MsgHeader As String

Try


' Do not put anything that will hold up the thread (e.g. MsgBox) between
' New queue and close queue, otherwise the message will hold until that process
' is cleared
'*******************************************************************************
'* Create the MQSession object and access the MQQueueManager and (local) MQQueue
'*******************************************************************************
FileOpen(1, "\Share\ACARSRTOW." & Format(Now(), "yyyyMMdd") & ".LOG", OpenMode.Append)

MQSess = New MQAX200.MQSession()
' PrintLine(1, "IsConnection property (queue manager) : " & Str(QMgr.IsConnected))
QMgr = MQSess.AccessQueueManager("")

If (InOut = 1) Then
' this is where the problem appear
PrintLine(1, "Queue ID : RTOW.IBMMSG.MTELEX.QR")
Queue = QMgr.AccessQueue("RTOW.IBMMSG.MTELEX.QR", MQAX200.MQ.MQOO_OUTPUT)
Else
PrintLine(1, "Queue ID : IBMMSG.RTOW.MTELEX.QL")
Queue = QMgr.AccessQueue("IBMMSG.RTOW.MTELEX.QL", MQAX200.MQ.MQOO_OUTPUT Or MQAX200.MQ.MQOO_INPUT_AS_Q_DEF)
End If


'*******************************************************************************
'* Create a new MQMessage object for use with put, add some data then create an
'* MQPutMessageOptions object and put the message
'*******************************************************************************
PutMsg = MQSess.AccessMessage()
PutMsgStr = OutStr
PutMsg.MessageData = PutMsgStr
PutOptions = MQSess.AccessPutMessageOptions()
Queue.Put(PutMsg, PutOptions)
PrintLine(1, "Reason code : " & Str(MQSess.ReasonCode))
PrintLine(1, "Reason name : " & MQSess.ReasonName)
PrintLine(1, "Completion code : " & Str(MQSess.CompletionCode))
PrintLine(1, " ")


'close after completed
Queue.Close()

PrintLine(1, " ")
PrintLine(1, "Reason code : " & Str(MQSess.ReasonCode))
PrintLine(1, "Reason name : " & MQSess.ReasonName)
PrintLine(1, "Completion code : " & Str(MQSess.CompletionCode))
PrintLine(1, " ")
PrintLine(1, "Connection Status : " & Str(QMgr.ConnectionStatus))
PrintLine(1, " ")
FileClose(1)

Catch ex As Exception

'Error Handling

' output error then quit the program
FileClose(1)
FileOpen(6, "\Share\ACARSRTOW.Err.Log", OpenMode.Append, OpenShare.Shared)
PrintLine(6, " ")
PrintLine(6, "Error found in Put_Queue @ ")
PrintLine(6, "Reason code : " & Str(MQSess.ReasonCode))
PrintLine(6, "Reason name : " & MQSess.ReasonName)
PrintLine(6, "Completion code : " & Str(MQSess.CompletionCode))
PrintLine(6, "Exception : " & ex.ToString)
PrintLine(6, "Message : " & ex.Message)
FileClose(6)

'close the program
Application.Exit()

End Try
End Sub




Does anyone know what's the possible cause of this or it is the problem of my piece of code?

Any hint is welcome.

Thanks in advance

SM Kwan
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ API Support » Unable to put message with VB.NET and MQAX
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.