Operating System - OpenVMS
1753760 Members
4772 Online
108799 Solutions
New Discussion юеВ

Re: Java to OpenVMS Mailbox

 
OwensJ
Advisor

Java to OpenVMS Mailbox

We have a legacy application which runs on OpenVMS which is written in C and listens on both Sockets and OpenVMS Mailboxes. I am writing a Java Webservice which is supposed to take a plain ASCII text string and forward that message to the legacy system. Rather than deal with the translation issues with the socket communications, I was wondering if anyone had some examples of how to write a string to an OpenVMS Mailbox from JAVA.
17 REPLIES 17
John Gillings
Honored Contributor

Re: Java to OpenVMS Mailbox

Treat the mailbox just as you would any other file.

If it doesn't work, please post any error messages.

A crucible of informative mistakes
OwensJ
Advisor

Re: Java to OpenVMS Mailbox

Wow really? I thought it was something like a memory queue. I can just open it and write text to it? This should be interesting.
Robert Gezelter
Honored Contributor

Re: Java to OpenVMS Mailbox

OwensJ,

I concur with John. While a mailbox is implemented as an in-memory data structure, its access from a program is as a normal file.

- Bob Gezelter, http://www.rlgsc.com
Richard J Maher
Trusted Contributor

Re: Java to OpenVMS Mailbox

Would OwensJ need/want to specify the mailbox as a stream mailbox for BufferedInputStream or is Java happy with records?

Cheers Richard Maher

PS. Java Sockets are fully functional and quite easy with oodles of examples all over the web.
OwensJ
Advisor

Re: Java to OpenVMS Mailbox

I've seen several examples and used Java sockets myself in the past, however never from Java to C, and on an OpenVMS system. I've read a few threads on here that say there may be some issues with this, though maybe not in straight text. I'm going to try it anyway later in the week, but since mailboxes are another alternative, I wanted to look into them since I had no idea how they worked on openvms.
Chris Barratt
Frequent Advisor

Re: Java to OpenVMS Mailbox

The language used at each socket really doesn't matter - a socket is a socket. As long as the sender and receiver are talking the same message format and character set, it doesn't matter. (We have Pascal servers receiving messages from C#, PHP, Java, C).

Personally, I'd go down the socket path first as it doesn't lock you into VMS mailboxes.

abrsvc
Respected Contributor

Re: Java to OpenVMS Mailbox

Since you are trying to avoid program changes, yes you can treat the mailbox just like a file. If it is easier, use a logical name to point to a real file for testing the data stream from the Java app. Point the logical to a mailbox for testing the real app. With VMS its just that simple.

Dan
John Apps
Occasional Advisor

Re: Java to OpenVMS Mailbox

You could use J2VMS for this too.
The snag with treating mailboxes as files is that the writer or reader hangs until someone reads or writes to the mailbox. Probably not a problem, but something to remember.
Have you thought about replacing the mailbox with either socket or perhaps lighweight queuing? Should not be hard and more natural to the Java environment; and much faster with no limitations on size or format of messages. Remember, mailboxes are record-formatted devices.
How many beans make 5?
abrsvc
Respected Contributor

Re: Java to OpenVMS Mailbox

RE: John

You are correct about the hang, IF, the read posted is a synchronous one. Since the app already uses mailboxes, I suspect that the reads are done async with an AST trigger. The emphasis here is that the asker here does not want to change the legacy app. Since it already handles mailboxes, writing to one should not be a problem.

Dan