| Author | 
		  Message
		 | 
		
		  | amna | 
		  
		    
			  
				 Posted: Tue Jan 25, 2011 2:22 am    Post subject: Connecting to MQ using a vb.net code | 
				     | 
			   
			 
		   | 
		
		
		   Newbie
 
 Joined: 23 Jan 2011 Posts: 3
  
  | 
		  
		    
			  
				Good Day, 
 
 
I am new to MQ and I want to make a program that connect and send Messages to MQ. I started by creating a code in vb.net without defining the server name, channel or  port and it works fine but becuase I will need to use this code from another machine I added 3 extra lines.
 
 
Currently all the development is done on the MQ server.
 
 
This is the code  I am using:
 
 
   
	| Code: | 
   
  
	Option Explicit On
 
Imports IBM.WMQAX
 
Imports IBM.WMQ.MQEnvironment
 
Imports IBM.WMQ.MQC
 
Imports System.IO
 
Imports System.Threading
 
Imports System.Data.SqlClient
 
Imports System.Messaging
 
 
Public Class Class1
 
Public mqEnvironment As IBM.WMQ.MQEnvironment
 
Dim MQSess As MQSession '* session object 
 
Dim QMgr As MQQueueManager '* queue manager object 
 
Dim Queue As MQQueue '* queue object 
 
Dim PutMsg As MQMessage '* message object for put 
 
Dim PutOptions As MQPutMessageOptions '* put message options 
 
Public GetOptions As MQGetMessageOptions '* to get message options
 
Dim PutMsgStr As String '* put message data string 
 
Public _WaitTime As Integer = 10000
 
Dim MQCHLTAB, APIO_ORIGINATOR, APIO_MSG_RCPT, MsgHeader As String
 
 
Public Sub SendMsg()
 
 
        'mqEnvironment.Hostname = "SR04WTRY1"
 
        'mqEnvironment.Channel = "SRC_QM.TO.TGT_QM"
 
        'mqEnvironment.Port = "1415"
 
 
        MQSess = New MQSession()
 
        QMgr = MQSess.AccessQueueManager("SRC_QM")
 
        Queue = QMgr.AccessQueue("SENDQ", MQOO_OUTPUT)
 
        PutMsg = MQSess.AccessMessage()
 
        PutMsg.MessageData = THEMESSAGE
 
        PutOptions = MQSess.AccessPutMessageOptions()
 
        Queue.Put(PutMsg, PutOptions)
 
End Sub
 
End Class | 
   
 
 
 
This code works fine but when uncheck the following 3 lines
 
       mqEnvironment.Hostname = "SR04WTRY1" ' this is the server name
 
       mqEnvironment.Channel = "SRC_QM.TO.TGT_QM" ' the sender  channel created in that QManager
 
       mqEnvironment.Port = "1415" 'the port number used in that channel 
 
 
I got this error
 
 
IBM.WMQ.MQException was unhandled
 
  Message="Error in the application."
 
  Source="amqmdnet"
 
  Reason=2059
 
  CompCode=2
 
 
Where am I making the mistake ?
 
Appreciate if anyone can help me with this
 
 
Thanks | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | mqjeff | 
		  
		    
			  
				 Posted: Tue Jan 25, 2011 2:35 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Grand Master
 
 Joined: 25 Jun 2008 Posts: 17447
  
  | 
		  
		    
			  
				You need to learn how to find out what MQRC's mean.  For example, if you enter the command 'mqrc 2059', it will give you some information.
 
 
Then you need to learn what the difference between a client connection and a bindings connection is.
 
 
You are not doing anything wrong in your code, it is working exactly correctly and exactly as documented. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | gbaddeley | 
		  
		    
			  
				 Posted: Wed Jan 26, 2011 4:31 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Jedi Knight
 
 Joined: 25 Mar 2003 Posts: 2538 Location: Melbourne, Australia 
  | 
		  
		    
			  
				
   
	| Quote: | 
   
  
	| mqEnvironment.Channel = "SRC_QM.TO.TGT_QM" ' the sender channel created in that QManager  | 
   
 
 
 
For a Client, this should be the name of a SVRCONN type channel, not a SENDER type. _________________ Glenn | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | amna | 
		  
		    
			  
				 Posted: Wed Jan 26, 2011 8:58 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Newbie
 
 Joined: 23 Jan 2011 Posts: 3
  
  | 
		  
		    
			  
				Mqjeff, 
 
I searched and It says that the causes is:
 
"You are running CA-OPS/MVS facility, and this is a problem with the state of MQ in the System State manager component"
 
and I need to: "Check your CA-OPS/MVS facility, since it could be a problem with the system state manager. You found that if you reset the system state for the STC to DOWN and back to UP and retry the connection to MQ, the 2059 error was cleared."
 
 
What is the CA-OPS/MVS? and how can I reset the system state?
 
 
 
Gbaddeley. 
 
 
I have only 2 channels in each MQ  a Sender and a Receiver
 
What is the SVRCONN Channel ? how can I create it created 
 
 
Thank you | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | amna | 
		  
		    
			  
				 Posted: Thu Jan 27, 2011 2:13 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Newbie
 
 Joined: 23 Jan 2011 Posts: 3
  
  | 
		  
		    
			  
				I am now connecting to a different MQ in a different Server 
 
and register it in explorer and used the SVRCONN Channel details and port 
 
 
The same issue found 
 
IBM.WMQ.MQException was unhandled 
 
Message="Error in the application." 
 
Source="amqmdnet" 
 
Reason=2059 
 
CompCode=2
 
 
What is the CA-OPS/MVS? and how can I reset the system state? | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | fatherjack | 
		  
		    
			  
				 Posted: Thu Jan 27, 2011 2:22 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Knight
 
 Joined: 14 Apr 2010 Posts: 522 Location: Craggy Island 
  | 
		  
		    
			  
				
   
	| amna wrote: | 
   
  
	| What is the CA-OPS/MVS? and how can I reset the system state? | 
   
 
 
 
It is/was a Systems Management product for mainframes from Computer Associates. Don't quite know how you got to this when searching for MQRC 2059. _________________ Never let the facts get in the way of a good theory. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | 
		    
		   |