[Migrated content. Thread originally posted on 21 April 2005]
Has anyone tried to incorporate Private message queues in acucobol.? I am needing to interface a 3rd party application using MSMQ and private message queues..
Any help is greatly appreciated.
Thanks
Jason
Using MSMQ in Acucobol is no problem at all.
Create a msmq.def file using AXDEFGEN on the Microsoft Message Queue Object Library, off the Libraries tab. Include the msmq.def file in the special-names.
Then in WS you need something like:
WORKING-STORAGE SECTION.
*=======================
*
77 mqdest HANDLE of MSMQDestination.
77 mqmess HANDLE of MSMQMessage.
In PROCEDURE DIV do:
CREATE MSMQDestination OF MSMQ HANDLE IN mqdest.
MODIFY mqdest PathName = ".\\private$\\myqueue".
MODIFY mqdest Open().
to open the private queue "myqueue".
to create a message do:
CREATE MSMQMessage OF MSMQ HANDLE IN mqmess.
to add "TEXT" to message body do:
MODIFY mqmess Body = "TEXT".
to send message do:
MODIFY mqmess Send(mqdest).
Do not forget to:
MODIFY mqdest Close().
DESTROY mqdest.
DESTROY mqmess.
to receive messages you need the following in WS:
77 mqmess HANDLE of MSMQMessage.
77 mqqinfo HANDLE of MSMQQueueInfo.
77 mqq HANDLE of MSMQQueue.
01 MISC.
10 MESSBODY PIC X(18).
then in PROCEDURE DIV do:
CREATE MSMQQueueInfo OF MSMQ HANDLE IN mqqinfo.
MODIFY mqqinfo PathName = ".\\private$\\myqueue".
MODIFY mqqinfo Open(MQ_RECEIVE_ACCESS,MQ_DENY_NONE) GIVING mqq.
Then create a message:
CREATE MSMQMessage OF MSMQ HANDLE IN mqmess.
Then pull a message off the queue by:
MODIFY mqq Receive() GIVING mqmess.
INQUIRE mqmess Body IN MESSBODY.
DISPLAY MESSBODY.
ACCEPT OMITTED.
Do not forget to:
MODIFY mqq Close().
DESTROY mqq.
DESTROY mqmess.
DESTROY mqqinfo.
This is in short what you need. If you like I have some sample programs to send and receive data. Works nice between VB and Acucobol, and it is awfully fast.
best regards,
Hans J
[Migrated content. Thread originally posted on 21 April 2005]
Has anyone tried to incorporate Private message queues in acucobol.? I am needing to interface a 3rd party application using MSMQ and private message queues..
Any help is greatly appreciated.
Thanks
Jason
Using MSMQ in Acucobol is no problem at all.
Create a msmq.def file using AXDEFGEN on the Microsoft Message Queue Object Library, off the Libraries tab. Include the msmq.def file in the special-names.
Then in WS you need something like:
WORKING-STORAGE SECTION.
*=======================
*
77 mqdest HANDLE of MSMQDestination.
77 mqmess HANDLE of MSMQMessage.
In PROCEDURE DIV do:
CREATE MSMQDestination OF MSMQ HANDLE IN mqdest.
MODIFY mqdest PathName = ".\\private$\\myqueue".
MODIFY mqdest Open().
to open the private queue "myqueue".
to create a message do:
CREATE MSMQMessage OF MSMQ HANDLE IN mqmess.
to add "TEXT" to message body do:
MODIFY mqmess Body = "TEXT".
to send message do:
MODIFY mqmess Send(mqdest).
Do not forget to:
MODIFY mqdest Close().
DESTROY mqdest.
DESTROY mqmess.
to receive messages you need the following in WS:
77 mqmess HANDLE of MSMQMessage.
77 mqqinfo HANDLE of MSMQQueueInfo.
77 mqq HANDLE of MSMQQueue.
01 MISC.
10 MESSBODY PIC X(18).
then in PROCEDURE DIV do:
CREATE MSMQQueueInfo OF MSMQ HANDLE IN mqqinfo.
MODIFY mqqinfo PathName = ".\\private$\\myqueue".
MODIFY mqqinfo Open(MQ_RECEIVE_ACCESS,MQ_DENY_NONE) GIVING mqq.
Then create a message:
CREATE MSMQMessage OF MSMQ HANDLE IN mqmess.
Then pull a message off the queue by:
MODIFY mqq Receive() GIVING mqmess.
INQUIRE mqmess Body IN MESSBODY.
DISPLAY MESSBODY.
ACCEPT OMITTED.
Do not forget to:
MODIFY mqq Close().
DESTROY mqq.
DESTROY mqmess.
DESTROY mqqinfo.
This is in short what you need. If you like I have some sample programs to send and receive data. Works nice between VB and Acucobol, and it is awfully fast.
best regards,
Hans J
[Migrated content. Thread originally posted on 21 April 2005]
Has anyone tried to incorporate Private message queues in acucobol.? I am needing to interface a 3rd party application using MSMQ and private message queues..
Any help is greatly appreciated.
Thanks
Jason
Hans J,
Thanks alot for the post...It's exactly what I needed.
Do you know of a way to load a message body of unknown size?
The 3rd party app I'm communicating with doesn't have a max on the message size to be passed...
Thanks again for your help..
JH
[Migrated content. Thread originally posted on 21 April 2005]
Has anyone tried to incorporate Private message queues in acucobol.? I am needing to interface a 3rd party application using MSMQ and private message queues..
Any help is greatly appreciated.
Thanks
Jason
Hello Jason,
What I usually do, if I don't know the message size, is create a WS item, to hold the message, of riduculous size, like 10MB or so.
Then, when the message has been received I think you can inquire it's size. Or you could count the number of trailing spaces to find out.
best regards,
Hans J
[Migrated content. Thread originally posted on 21 April 2005]
Has anyone tried to incorporate Private message queues in acucobol.? I am needing to interface a 3rd party application using MSMQ and private message queues..
Any help is greatly appreciated.
Thanks
Jason
Hans,
Have you tried setting the Receivetimout on the Receive method?
Here's the code I'm using
Working Storage...
77 W-Var-ReceiveTimeout usage handle.
Procedure......
....
MODIFY mqq @Receive(
by name @ReceiveTimeout W-Var-ReceiveTimeout
)
GIVING mqmessr.
Here's the snippet from the def file.
* Method to synchronously retrieve a message from a queue. It always
* removes the first message in the queue regardless of the position of the
* implicit cursor. Optional parameters include ReceiveTimeout (default set
* to INFINITE), Transaction (default set to MTS Transaction),
* WantDestinationQueue (default set to False), and WantBody (default set
* to True).
METHOD, 1610743814, @Receive,
"VARIANT*" @Transaction, TYPE 16396,
"VARIANT*" @WantDestinationQueue, TYPE 16396,
"VARIANT*" @WantBody, TYPE 16396,
"VARIANT*" @ReceiveTimeout, TYPE 16396
OPTIONAL 4
RETURNING "IMSMQMessage*", TYPE 9
Thanks for the help.
[Migrated content. Thread originally posted on 21 April 2005]
Has anyone tried to incorporate Private message queues in acucobol.? I am needing to interface a 3rd party application using MSMQ and private message queues..
Any help is greatly appreciated.
Thanks
Jason
Hans,
Have you tried setting the Receivetimout on the Receive method?
Here's the code I'm using
Working Storage...
77 W-Var-ReceiveTimeout usage handle.
Procedure......
....
MODIFY mqq @Receive(
by name @ReceiveTimeout W-Var-ReceiveTimeout
)
GIVING mqmessr.
Here's the snippet from the def file.
* Method to synchronously retrieve a message from a queue. It always
* removes the first message in the queue regardless of the position of the
* implicit cursor. Optional parameters include ReceiveTimeout (default set
* to INFINITE), Transaction (default set to MTS Transaction),
* WantDestinationQueue (default set to False), and WantBody (default set
* to True).
METHOD, 1610743814, @Receive,
"VARIANT*" @Transaction, TYPE 16396,
"VARIANT*" @WantDestinationQueue, TYPE 16396,
"VARIANT*" @WantBody, TYPE 16396,
"VARIANT*" @ReceiveTimeout, TYPE 16396
OPTIONAL 4
RETURNING "IMSMQMessage*", TYPE 9
Thanks for the help.
[Migrated content. Thread originally posted on 21 April 2005]
Has anyone tried to incorporate Private message queues in acucobol.? I am needing to interface a 3rd party application using MSMQ and private message queues..
Any help is greatly appreciated.
Thanks
Jason
Jason,
I have not tested this. But it looks quite interesting.
Thanks for the tip.
br,
Hans