Home > database >  By PB9.0 MQSeries programming, how to judge when you pick up the message queue is no news?
By PB9.0 MQSeries programming, how to judge when you pick up the message queue is no news?

Time:09-24

MQS=CREATE OLEObject//MQSeries Session
QM=CREATE OLEObject//QueueManager
Q=the CREATE OLEObject//Queue
MW=CREATE OLEObject//the Message Written
MR=CREATE OLEObject//Message Read
PO=CREATE OLEOBject//Put options
GO=CREATE OLEOBject//Get the options
I=MQS. ConnectToNewObject (" MQAX200. MqSession ")//see note 1
QM=MQS. AccessQueueManager (" MQ_GET ")
Q=QM. AccessQueue (" GET. LQ ", 2)//see note 3
MR=MQS. AccessMessage ()

Mr. MessageIdHex=Mr. MessageIdHex
GO=MQS. AccessGetMessageOptions ()
Q.G et (MR, GO)
Sle_2. Text=Mr. ReadString (Mr. MessageLength)

Q.c lose ()

So that is in the queue to have messages can be received, but if you don't have an error message

CodePudding user response:

ReadString method This method reads n bytes from the Message Data buffer starting with the byte referred to by DataOffset and returns it as an ActiveX string. The method fails if MQMessage.DataLength is less than n when it is issued. DataOffset is incremented by n and DataLength is decremented by n if the method succeeds. The n characters of message data are assumed to be a string whose code page is specified by the MQMessage.CharacterSet property. Conversion to ActiveX representation is performed for the application. Defined in: MQMessage class Syntax: stringv$=MQMessage.ReadString(length&) The Parameter length& Long. The Length of the string field in bytes.

CodePudding user response:

If MR DataLength & gt;=Mr. MessageLength then
Sle_2. Text=Mr. ReadString (Mr. MessageLength)
End the if

Try this

CodePudding user response:

Refer to the following document
http://publibfp.boulder.ibm.com/epubs/pdf/amqtan03.pdf
http://publibfp.boulder.ibm.com/epubs/pdf/csqzac05.pdf
  • Related