|   | 
	 
  
    | 
RSS Feed - WebSphere MQ Support
 | 
RSS Feed - Message Broker Support
 |   
 
  
	     | 
	 | 
   
 
  
	|  Unable to put message with VB.NET and MQAX | 
	« View previous topic :: View next topic »  | 
   
  
  	
	  
		
		
		  | Author | 
		  Message
		 |  
		
		  | smkwan | 
		  
		    
			  
				 Posted: Sun Jun 23, 2002 9:15 pm    Post subject: Unable to put message with VB.NET and MQAX | 
				     | 
			   
			 
		   | 
		 
		
		   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 | 
		  
		  	
		   | 
		 
		
		    | 
		 
		
		  | 
		    
		   | 
		 
	   
	 | 
   
 
  
	     | 
	 | 
	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
  | 
  		 
	   
	 | 
   
 
  	 | 
	  |