 |
» |
|
 |
|
 |

Copyright (c) Digital Equipment Corporation 1988, 1989. All rights reserved
LAYERED PRODUCT: PLI V3.2 OP/SYS: VMS V5.0
SOURCE: Digital Customer Support Center
OVERVIEW:
This program demonstrates how to create a mailbox, how to write messages to
it and how to determine how many messages have been written to it.
CAUTION: This sample program has been tested using:
PRODUCT: PLI V3.2 on OPERATING SYSTEM: VMS V5.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:
This program first calls SYS$CREMBX to create a temporary mailbox.
Messages are then written to the mailbox with calls to SYS$QIOW.
Finally, LIB$GETDVI is called to determine the number of messages in
the mailbox.
PROGRAM SAMPLE:
TEMPMBX: proc options(main);
%include $ssdef; %include $stsdef; %include $iodef; %include $dvidef; %include
sys$assign; %include sys$dassgn; %include sys$qio; %include sys$crembx;
%include lib$getdvi;
dcl mbxname char(6) init('MBXTMP');
dcl mbxchan fixed bin(15);
dcl nummsg fixed bin(31);
dcl function1 bit(16) aligned;
dcl function2 fixed bin(31);
dcl p1 char(20) init('Mailbox Message');
dcl p2 fixed bin(31) init(20);
dcl iosb(4)fixed bin(15);
dcl i fixed bin(31);
dcl j fixed bin(31);
/* create the mailbox */
sts$value = sys$crembx(,mbxchan,,,,,mbxname);
IF ^sts$success
then signal vaxcondition(sts$value);
/* find out how many messages to be written to mailbox */
put skip list ('Enter the number of messages to be sent to the mailbox: ');
get list (i);
/* set the function code, notes io$m_now will allow the qio to
complete without the message being read from the mailbox */
function1 = io$_writevblk | io$m_now;
function2 = dvi$_devdepend;
do j = 1 to i;
/* write messages to mailbox */
sts$value = sys$qiow(,mbxchan,function1,iosb,,,p1,p2,,,,);
if ^sts$success
then signal vaxcondition(sts$value);
if iosb(1) ^= ss$_normal
then signal vaxcondition(IOSB(1));
end;
/* retrieve number of messages in the mailbox */
sts$value = lib$getdvi(function2,mbxchan,,nummsg,,);
if ^sts$success
then signal vaxcondition(sts$value);
put skip list('The number of messages in the mailbox are: ',nummsg);
/* deassign the mailbox channel */
sts$value = sys$dassgn(mbxchan);
IF ^sts$success
then signal vaxcondition(sts$value);
end tempmbx;
|
buy online or call 1.800.AT.COMPAQ
|
|