Path: utzoo!attcan!uunet!mcvax!enea!erix!bengtb From: bengtb@erix.UUCP (Bengt Baeverman) Newsgroups: comp.os.vms Subject: Re: VMS Mailboxes Message-ID: <1616@erix.UUCP> Date: 18 May 88 19:02:24 GMT Reply-To: bengtb@erix.UUCP (Bengt Baverman) Organization: Ericsson Telecom, Stockholm, Sweden Lines: 87 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.