[comp.os.vms] VMS Mailboxes

eckhgb@atrium.UUCP (Gary B Eckhardt) (04/10/88)

Help!  I am in need of some good examples using VAX virtual mailboxes.
The one example they have in the System Services guide leaves much
to be desired.  What I need to do is simply get two separate jobs
running on the same machine to communicate.  The language I would
like to see examples from is Pascal (that's what the project is
written in) but ANY language will suffice, I just need some good
examples.  Thanks for any help!

                                   --Gary Eckhardt

+-------------------------------------------------------------------------+
! BITNET : $GBE2895 AT UTSAVM1                                            !
! UUCP   : gatech!petro!atrium!eckhgb       "Thanks to modern caffiene,   !
! TEXNET : UTSA80::CS475301013               sleep is now optional!"      !
+-------------------------------------------------------------------------+
 

MISH@VMS3.MACC.WISC.EDU (Tom Mish - MACC) (05/06/88)

>Help!  I am in need of some good examples using VAX virtual mailboxes.
>The one example they have in the System Services guide leaves much
>to be desired.  What I need to do is simply get two separate jobs
>running on the same machine to communicate.  The language I would
>like to see examples from is Pascal (that's what the project is
>written in) but ANY language will suffice, I just need some good
>examples.  Thanks for any help!
>
>                                   --Gary Eckhardt
 
 Gary,
   I beleive that there are a few more examples in the Using PASCAL on
VMS manual, or some such thing. I was trying to do the same thing a few years
ago, but gave up because I found an easier way.
 
   Good Luck
 
_____________________     ____________________________     ___________________
                     \   /                            \   /
      Tom             \ /     Bit: mish@wiscmacc       \ /      Univ. Of Wis.
       Mish            X  Arpa: mish@vms.macc.wisc.edu  X        Madison
        Jr.           / \    Phone: (608) 262-8525     / \        MACC
_____________________/   \____________________________/   \___________________

bengtb@erix.UUCP (Bengt Baeverman) (05/19/88)

Sending and receiving things through mailboxes are not that complicated.
Below are two programs that can be run by two processes in the same group.

This receiver side has to create the mailbox and wait for a message
before the sender can see the mailbox and send the message.

[inherit('sys$library:starlet')]
program receiver (input, output);
const
    mailboxname	= 'demo_box';

type
    word	= [word] 0..65535;
    iosbtype	= record
    		      status	: word;
		      count	: word;
		      pid	: unsigned;
    		  end;

var
    string	: varying [255] of char;
    channel	: word;
    status	: unsigned;
    iosb	: iosbtype;

    procedure lib$signal(%immed signal: unsigned); external;

begin
    status := $crembx(chan := channel, lognam := mailboxname);
    if not odd(status) then lib$signal(status);

    status := $qiow(chan := channel, func := io$_readvblk, iosb := iosb,
    		    p1 := string.body, p2 := size(string.body));
    if not odd(status) then lib$signal(status);
    if not odd(iosb.status) then lib$signal(iosb.status);

    string.length := iosb.count;

    writeln('I just recieved <', string, '>');

    status := $dassgn(channel);
    if not odd(status) then lib$signal(status);
end.

[inherit('sys$library:starlet')]
program sender (input, output);
const
    mailboxname	= 'demo_box';

type
    word	= [word] 0..65535;
    iosbtype	= record
    		      status	: word;
		      count	: word;
		      pid	: unsigned;
    		  end;

var
    string	: varying [255] of char;
    channel	: word;
    status	: unsigned;
    iosb	: iosbtype;

    procedure lib$signal(%immed signal: unsigned); external;

begin
    status := $crembx(chan := channel, lognam := mailboxname);
    if not odd(status) then lib$signal(status);

    status := $qiow(chan := channel, func := io$_readvblk, iosb := iosb,
    		    p1 := string.body, p2 := size(string.body));
    if not odd(status) then lib$signal(status);
    if not odd(iosb.status) then lib$signal(iosb.status);

    string.length := iosb.count;

    writeln('I just recieved <', string, '>');

    status := $dassgn(channel);
    if not odd(status) then lib$signal(status);
end.

Good luck!

	bengt baverman, bengtb@erix.se
	OPIAB Digitech, Stockholm, Sweden.