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!

MQSeries Client for Windows 2000

Status
Not open for further replies.

getjbb

MIS
Jun 4, 2003
139
US
Hi,

I have example code using MQSeries Client for Windows 2000 within PowerBuilder, but the example does not tell where the
code should go. I was wondering do I have to build a NVO.

getjbb
 
The code is:

$PBExportHeader$mqod.srs
global type mqod from structure //MQ Object Descriptor
character strucid[4]
long version
long objecttype
character objectname[48]
character objectqmgrname[48]
character dynamicqname[48]
character alternateuserid[12]
end type

$PBExportHeader$mqmd.srs //MQ Message Descriptor
global type mqmd from structure
character StrucId[4]
long Version
.
.
.
end type

$PBExportHeader$mqpmo.srs //MQ Put Message Options
global type mqpmo from structure
character StrucId[4]
long Version
.
.
.
end type

--------------------------------------------

public subroutine initializemqstructures ();
// Initialize Object Descriptor structure
mqod_default.StrucId = { "O", "D", " ", " " }
mqod_default.Version = 1
mqod_default.ObjectType = 1
// Queue name
mqod_default.ObjectName = { "D", "E", "F", "A", "U", "L", "T" }
mqod_default.ObjectQMgrName = ""
mqod_default.DynamicQName = "AMQ.*"
mqod_default.AlternateUserId = " "

// Initialize Message Descriptor
mqmd_default.StrucId = { "M", "D", " ", " " }
.
.
.
end subroutine
----------------------------------------------------

type prototypes
// Declare MQSeries external functions

Subroutine MQCLOSE &
( Long Hconn, REF Long Hobj, Long Options, REF Long CompCode, &
REF Long Reason ) &
Library "MQIC32.DLL" alias For "MQCLOSEstd@20"

Subroutine MQCONN &
( String QMgrName, REF Long Hconn, REF Long CompCode, REF Long Reason ) &
Library "MQIC32.DLL" alias for "MQCONNstd@16"

Subroutine MQDISC &
( REF Long Hconn, REF Long CompCode, REF Long Reason ) &
Library "MQIC32.DLL" alias for "MQDISCstd@12"

Subroutine MQOPEN &
( Long Hconn, REF MQOD ObjDesc, Long Options, REF Long Hobj, &
REF Long CompCode, REF Long Reason) &
Library "MQIC32.DLL" alias for "MQOPENstd@24"

Subroutine MQPUT &
( Long Hconn, Long Hobj, REF MQMD MsgDesc, REF MQPMO PutMsgOpts, &
Long BufferLength, REF String Buffer, REF Long CompCode, &
REF Long Reason ) &
Library "MQIC32.DLL" Alias For "MQPUTstd@32"

---------------------------------------------------------

// Initialize MQ structures
initializemqstructures()

// Set the size of the data to be sent
bufferLength = Len(ls_xmlstring)

// Connect to default Queue Manager
MQCONN("", gHcon, CompCode, Reason)
IF CompCode = MQCC_FAILED THEN
MessageBox("MQCONN","MQCONN: CompCode = " + String(CompCode) + ", &
Reason Code = " + String(Reason))
Return
END IF

// Open default queue
MQOPEN(gHcon, mqod_default, MQOO_OUTPUT, qHandle, CompCode, Reason)
IF CompCode <> 0 THEN
MessageBox(&quot;MQOPEN&quot;,&quot;MQOPEN: CompCode = &quot; + String(CompCode) + &quot;, &
Reason Code = &quot; + String(Reason))
Return
END IF

// Put XML on default queue
MQPUT(gHcon, qHandle, mqmd_default, mqpmo_default, bufferLength, ls_xmlstring, CompCode, Reason)
IF CompCode <> 0 THEN
MessageBox(&quot;MQPUT&quot;,&quot;MQPUT: CompCode = &quot; + String(CompCode) + &quot;, &
Reason Code = &quot; + String(Reason))
Return
END IF

// Close queue
MQCLOSE(gHcon, qHandle, MQCO_NONE, CompCode, Reason)
IF CompCode <> 0 THEN
MessageBox(&quot;MQCLOSE&quot;,&quot;MQCLOSE: CompCode = &quot; + String(CompCode) + &quot;, &
Reason Code = &quot; + String(Reason))
Return
END IF

// Disconnect queue
MQDISC(gHcon, CompCode, Reason)
IF CompCode <> 0 THEN
MessageBox(&quot;MQDISC&quot;,&quot;MQDISC: CompCode = &quot; + String(CompCode) + &quot;, &
Reason Code = &quot; + String(Reason))
Return
END IF



getjbb
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top