 |
» |
|
 |
|
 |

Copyright (c) Digital Equipment Corporation 1994. All rights reserved
PRODUCT: VAX PL/I
DEC PL/I for OpenVMS AXP
OP/SYS: OpenVMS VAX
OpenVMS AXP
SOURCE: Digital Equipment Corporation
OVERVIEW:
This example will issue a $QIOW to the terminal specifying a '?'
character as the only valid terminator.
*** CAUTION ***
This sample program has been tested using VAX PL/I V3.5-124 on OpenVMS
VAX V6.1 and DEC PL/I V4.0-5 on OpenVMS AXP V1.5. However, we cannot
guarantee its effectiveness because of the possibility of error 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 example will demonstrate the long form terminator mask for QIO
read operations. The mask will define the question-mark '?' as the read
terminator. The QIO READ operation will terminate when the buffer is
full or the '?' character has been pressed.
Compile/Link Run Commands:
$ PLI QIOTERM
$ LINK QIOTERM
$ RUN QIOTERM
PROGRAM:
qioterm: proc options(main);
%include sys$qio;
%include $iodef;
%include sys$assign;
%include $stsdef;
%include $ssdef;
dcl term char(10) init('sys$output');
dcl termch fixed bin(15);
dcl iosb(4) fixed bin(15);
/*
Declare the long form terminator mask. Please refer to the OpenVMS
I/O User's Guide Reference Manual, page 5-31 for the layout of
the long form terminator mask.
*/
dcl mymask(4) fixed binary(15);
dcl 1 longmask,
2 masksize fixed binary(15),
2 notused fixed binary(15),
2 maskaddr pointer;
/*
The QIO input buffer is 10 characters. The read will terminate
when the buffer is full or when the specified terminator has
been pressed.
*/
dcl readbuffer char(10);
/*
assigning the channel
*/
sts$value = sys$assign(term,termch,,);
if ^sts$success
then do;
put skip list('Problems with assign');
signal vaxcondition(sts$value);
end;
/*
Initialize the terminator mask. This example will set up the '?'
mark as the only valid terminator. The read will terminate either
when the buffer is full or the '?' character has been pressed.
*/
mymask(1) = 0;
mymask(2) = 0;
mymask(3) = 0;
unspec(mymask(4)) = '0000000000000001'b;
/*
Point the mask address longword of the long form terminator
mask to the terminator mask (mymask).
*/
longmask.masksize = 8;
longmask.notused = 0;
longmask.maskaddr = addr(mymask);
/*
Issue the QIO read to the terminal.
*/
sts$value = sys$qiow(,termch,IO$_READVBLK,iosb,,,readbuffer,
10,,addr(longmask),,);
if ^sts$success
then do;
put skip list('Problems with QIOW');
signal vaxcondition(sts$value);
end;
/*
Report what the terminator was. If the read was terminated
by a '?' character, the 3rd word of the READ IOSB will have
ASCII 63 in it. Note that control characters will not be
interpreted as terminators. Please refer to the OpenVMS
I/O User's Guide Reference Manual, page 5-32 for a discussion
on read terminators.
*/
sts$value = iosb(1);
if ^sts$success
then do;
put skip list('Problems with QIOW iosb:',iosb(1));
signal vaxcondition(iosb(1));
end;
put skip list('Read terminated by ',iosb(3));
end qioterm;
REFERENCES:
"OpenVMS I/O User's Guide Reference Manual", May 1993, (AA-PV6SA-TK),
page(s) 5-28, 5-29, 5-30, 5-31
|
buy online or call 1.800.AT.COMPAQ
|
|