 |
» |
|
 |
|
 |

Copyright (c) Digital Equipment Corporation 1988. All rights reserved
LAYERED PRODUCT: PLI, VERSION 3.1 OP/SYS: VMS, VERSION 5.0
SOURCE: Digital Customer Support Center
OVERVIEW:
The following programs demonstrate how to create a temporary mailbox.
One program then writes a message to the mailbox. The other program
read the mailbox and then displays the message.
CAUTION: This sample program has been tested using PLI, Version 3.1 on
VMS, Version 5.0. However, we cannot guarantee its effectiveness
because of the possibility of errors in transmitting or implementing
it. It is meant to be used as a template for writing your own
program, and it may require modification for use on your system.
PROGRAM NOTES:
The program was compiled, linked, and run with the following commands:
$PLI TEMPMAIL1.PLI
$PLI TEMPMAIL2.PLI
$LINK TEMPMAIL1.PLI
$LINK TEMPMAIL2.PLI
$SPAWN/NOWAIT $RUN TEMPMAIL1 !This allow both programs to be
$RUN TEMPMAIL2 !run from the same terminal
PROGRAM SAMPLE:
TEMPMBX1: proc options(main);
/*This program creates a temporary mailbox, and writes a message
to the mailbox */
%include $iodef;
%include SYS$QIO;
%include SYS$CREMBX;
%include $SSDEF;
%include $STSDEF;
dcl MBXNAME char(6) init('drsmbx');
dcl channel fixed bin(15);
dcl efn fixed bin(31) init(2);
dcl func bit(16) aligned init(IO$_writeVBLK);
dcl p1 char(14) init('drs to Mailbox');
dcl p2 fixed bin(31) init(14);
dcl iosb(4)fixed bin(15);
/* create the mailbox - named DRSMBX */
sts$value = sys$CREMBX(,channel,,,,,mbxname);
IF ^sts$success
then do;
put skip list('Problems with CREMBX');
signal vaxcondition(sts$value);
end;
/* perform a qio write virtual block to write a message to the
mailbox */
sts$value = sys$qiow(efn,channel,func,iosb,,,p1,p2,,,,);
IF ^sts$success
then do;
put skip list('Problems with QIOW');
signal vaxcondition(sts$value);
end;
if iosb(1) ^=SS$_normal
then do;
put skip list('Problems with QIOW, IOSB1:',iosb(1));
signal vaxcondition(IOSB(1));
end;
put skip list('TEMPMAIL1 has completed');
end tempmbx1;
TEMPMBX2: proc options(main);
/* This program reads a message from a temporary mailbox */
%include $iodef;
%include SYS$QIO;
%include SYS$CREMBX;
%include $SSDEF;
%include $STSDEF;
dcl MBXNAME char(6) init('drsmbx');
dcl channel fixed bin(15);
dcl efn fixed bin(31) init(2);
dcl func bit(16) aligned init(IO$_readVBLK);
dcl p1 char(30);
dcl p2 fixed bin(31) init(30);
dcl iosb(4)fixed bin(15);
/*associate to the mailbox, created in tempmail1 - DRSMBX*/
sts$value = sys$CREMBX(,channel,,,,,mbxname);
IF ^sts$success
then do;
put skip list('Problems with CREMBX');
signal vaxcondition(sts$value);
end;
/* read the message from the mailbox */
sts$value = sys$qiow(efn,channel,func,iosb,,,p1,p2,,,,);
IF ^sts$success
then do;
put skip list('Problems with QIOW');
signal vaxcondition(sts$value);
end;
if iosb(1) ^=SS$_normal
then do;
put skip list('Problems with QIOW, IOSB1:',iosb(1));
signal vaxcondition(IOSB(1));
end;
put skip list('Message from mailbox: ',P1);
put skip list('TEMPMAIL2 has completed');
end tempmbx2;
|
buy online or call 1.800.AT.COMPAQ
|
|