- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - OpenVMS
- >
- Process mailbox usage simple question
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-18-2008 07:34 AM
тАО11-18-2008 07:34 AM
I'm reading Mailbox SYS routines documentation
regard to synchronious I/O (to use standard I/O stream routines)
http://h30266.www3.hp.com/odl/vax/opsys/vmsos73/vmsos73/5841/5841pro_007.html
for example
and do not understand simple things.
I just translate 2 simple programs published at the doc from Fortran to C and wish it communicable
/* MAIN: */
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
main()
{
int stat_R0;
int mbx_chan;
FILE *M;
char s[1024];
$DESCRIPTOR( MBX_NAME, "MAIL_BOX" );
$DESCRIPTOR( SUBPROC, "RU SUBPROCESS.EXE");
stat_R0 = SYS$CREMBX (0,&mbx_chan,
NULL,NULL,NULL,NULL,
&MBX_NAME);
if((stat_R0 & 1) != 1)
LIB$SIGNAL(stat_R0);
if ( (M=fopen("MAIL_BOX","w+"))==NULL )
perror("cant fopen mailbox\n");
stat_R0 = LIB$SPAWN ( &SUBPROC );
fprintf(M,"hello\n ");
fgets(s,256,M);
if((stat_R0 & 1) != 1) perror("error spawn\n");
printf("%s\n",s);
}
/* SUBPROCESS */
#include
#include
#include
#include
#include
$DESCRIPTOR ( MBX, "MAIL_BOX" );
main()
{
int mbx_chan;
int stat_R0;
FILE *M;
char s[256];
stat_R0 = SYS$ASSIGN(&MBX,&mbx_chan,0,0);
if ( (stat_R0 & 1) != 1 )
perror("Error sys$assign\n");
if ( (M=fopen("MAIL_BOX","r+"))==NULL )
perror("get mailbox error\n");
fgets(s,255,M);
printf("read data: %s\n",s);
fprintf(M,"Answer: %s",s);
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-18-2008 07:38 AM
тАО11-18-2008 07:38 AM
Re: Process mailbox usage simple question
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-18-2008 08:40 AM - last edited on тАО04-11-2017 01:32 AM by VidyaVI
тАО11-18-2008 08:40 AM - last edited on тАО04-11-2017 01:32 AM by VidyaVI
SolutionThere is no way I'd mix C standard I/O with mailboxes.
Can it work? Sure, but OpenVMS isn't Unix and everything isn't really streams of bytes on OpenVMS; trying to get C file semantics on RMS semantics on OpenVMS file semantics onto what are really mailbox devices tends to get, um, hairy.
Here's your example program, slightly rewritten:
[broken link removed on <4/11/2017> by Mod]
(there's a build procedure in the same directory.)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-18-2008 09:30 AM
тАО11-18-2008 09:30 AM
Re: Process mailbox usage simple question
int flags = CLI$M_NOWAIT;
...
stat_R0 = LIB$SPAWN ( &SUBPROC, NULL, NULL, &flags );
But I agree with Hoff that using standard C I/O with mailboxes is a bad idea. By default C I/O is stream oriented and mailboxes are record oriented and these don't mix well.
You might be able to get it to work by adding , "ctx=rec" to your FOPEN calls. If you do, then you don't need to SYS$ASSIGN a channel in the subprocess - that would only be needed if you were using SYS$QIOW call to read/write data.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-18-2008 11:02 PM
тАО11-18-2008 11:02 PM
Re: Process mailbox usage simple question
but can we discuss your example?
Ido not understand many things.
At MASTER mode you create mailbox named
"MBXNAM", right?
/*--- MASTER ----*/
$DESCRIPTOR( mbxnam_d, MBXNAM );
status = sys$crembx(0, &channel, MAXMBXMSG, MAXMBXBUF,
0, 0, &mbxnam_d, 0);
/* ------ */
Very good.
But for SLAVE process you opens SYS$INPUT,
attached to devnam_d that is not mailbox.
(I do not totally understand what value devnam_d is in your example, but it is a second question)
/* SLAVE */
$DESCRIPTOR( sysinp_d, "SYS$INPUT");
status = sys$assign( &sysinp_d, &channel, 0, 0, 0 );
/*--- */
Where you are reading from mailbox here ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-18-2008 11:18 PM
тАО11-18-2008 11:18 PM
Re: Process mailbox usage simple question
I added flag you pointed.
when started, I just get string "hello"
on my terminal just like it simple typed by
printf("Hello");
I do not understand how it works. :(
It seems, so many years ago I was little yunger and clear :) (I am 33 now ) and could understand documentation. I had studed RT-11,TSX and P/OS on my Russian clone of Pro-350 17 years ago without any problems. And without Internet of course ;)
Documentation was clear for me. It seems I got a foolish for years for a distance from 1995 when I begun to study unix :) or documentation now from HP is not good as was from DEC.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-18-2008 11:51 PM
тАО11-18-2008 11:51 PM
Re: Process mailbox usage simple question
the 'slave' process is being started with a $CREPRC system service, passing devnam_d as the SYS$INPUT file/device name. devnam_d is the descriptor for the devnam_b string, which contains the full device name of the mailbox obtained via a $GETDVIW call on the mailbox device channel.
Volker.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-19-2008 12:41 AM
тАО11-19-2008 12:41 AM
Re: Process mailbox usage simple question
Ok, thank you.
now I understand a coupe of things...
It is interesting how MACRO concepts going to C. It is not clean sometimes ;) C is not best language for OpenVMS IMHO...
Found good thing:
http://www.openvms.compaq.com/openvms/journal/v9/mailboxes.pdf
I'm reading it...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-19-2008 02:35 AM
тАО11-19-2008 02:35 AM
Re: Process mailbox usage simple question
page 12, Example 5
Another strange thing, strange behavor
This program should read strings from console and put into mailbox. And this is *screeshot* from the article:
-----------
$ r mailbox_writer
Bruce Ellis was here
Welcome to Mailboxes from BRUDEN-OSSG
We have lot's of great guys and a great Guy on board.
Control-Z was entered on the next line.
Exit
$
-----------
I've compiled sources from the acticle, but execution freezes during SYS$QIOW call
What's happens?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-19-2008 02:45 AM
тАО11-19-2008 02:45 AM
Re: Process mailbox usage simple question
http://h71000.www7.hp.com/doc/732FINAL/aa-pv6sf-tk/aa-pv6sf-tk.HTMl
As some things have changed like stream I/O is now possible with mailboxes (although I don't know why).
Purely Personal Opinion