Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Visual basic sample explaining mqconnx

Status
Not open for further replies.

gilmore9

MIS
May 13, 2003
2
EG
HI All,

Can someone describe or show an example of connecting to a queue w/ visual basic and the api mqconnx?

Thanks in advance.

Mike Gilmore
 
'An example for you..
Dim o_Options As Long ' MQOPEN options
Dim od As MQOD ' Object descriptor

MQMD_DEFAULTS md
md.MsgId = MQRO_NEW_MSG_ID
md.ReplyToQ = ReplyQueue
md.ReplyToQMgr = ReplyQueueManager


If gHcon = 0 Then
' Connect to the default queue manager
MQCONN "", gHcon, CompCode, Reason

fraPut.cboAPIRC.AddItem "MQCONN: CompCode = " + Str(CompCode) + ", Reason Code = " + Str(Reason), 0
fraPut.cboAPIRC.ListIndex = 0


od.ObjectQMgrName = QueueManager 'inparameter
md.MsgId = MQRO_NEW_MSG_ID

md.ReplyToQ = ReplyQueue
md.ReplyToQMgr = ReplyQueueManager

o_Options = MQOO_OUTPUT
MQOPEN gHcon, od, o_Options, gHobj, CompCode, Reason

fraPut.cboAPIRC.AddItem "MQOPEN: CompCode = " + Str(CompCode) + ", Reason Code = " + Str(Reason), 0
fraPut.cboAPIRC.ListIndex = 0

'Runs put command

'Dim md As MQMD ' Message descriptor
Dim pmo As MQPMO ' MQPUT message options

' Setup MQMD and MQPMO to their respective
' initial values
MQMD_DEFAULTS md
md.Format = MQFMT_STRING

MQPMO_DEFAULTS pmo

' Get message to be "put" from the Put text box
Buflen = Len(fraPut.txtPut.Text)
Buffer = fraPut.txtPut.Text
MQPUT gHcon, gHobj, md, pmo, Buflen, Buffer, CompCode, Reason
fraPut.cboAPIRC.AddItem "MQPUT: CompCode = " + Str(CompCode) + ", Reason Code = " + Str(Reason), 0
fraPut.cboAPIRC.ListIndex = 0

Counter = Counter + 1
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top