Jump to page titleUNITED STATES
hp.com home products and services support and drivers solutions how to buy
» contact hp

:

more options
 

hp.com home
End of Jump to page title
Example-PLI How To Perform A CTRL/C AST With A QIO
Jump to content



» 

business support center

Home & Home Office Support:
» HP branded products
» Presario branded products
» Services & Warranties
Small & Medium Business Support:
» Small & Medium Business products
» Small & Medium Business services
Support for IT Professionals:
» Enterprise products (IT Resource Center)
» NonStop enterprise products
» Business & IT Services
Content starts here
Copyright (c) Digital Equipment Corporation 1988. All rights reserved
LAYERED PRODUCT or COMPONENT: PLI, VERSION 3.1     OP/SYS: VMS, VERSION 5.0

SOURCE:     Digital Customer Support Center



OVERVIEW:

The following programs demonstrate how to perform a CTRL/C AST with a
QIO. The first program prompts the user for response.  If data is
entered at the prompt, it is echoed back to the screen.  If no data is
entered within 5 seconds, the request is canceled.  If a CTRL/C
is typed, then an AST routine (the second program) will be triggered
that displays a message onto the screen.

CAUTION:  This sample program has been tested using PLI, Version 3.1
on operating system VMS, Version 5.0. However, we cannot guarantee its
effectiveness because of the possibility of errors in transmission or
implementation.  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 SAMPLE:

ctlcast1: proc options(main);

%include sys$qio;
%include $iodef;
%include sys$assign;
%include $ssdef;
%include $stsdef;

dcl term char(11) init('sys$command');
dcl termch fixed bin(15) init(0);
dcl iosb(4) fixed bin(15);
dcl func bit(16) aligned;
dcl prompt char(65)
    init('You have 5 seconds to enter data, or type ctrl/c. NOECHO is on.  ');
dcl buffer char(10) init(' ');
dcl ctlcast2 entry(pointer);

/* assign the terminal channel*/

sts$value = sys$assign(term,termch,,);

IF ^sts$success then signal vaxcondition(sts$value);

/*perform the control C qio*/
func = io$_setmode|io$m_ctrlcast;
sts$value = sys$qiow(,
                     value(termch),
                     value(func),
                     reference(iosb),,,
                     value(ctlcast2),
                     ref(termch),,,,);

if ^sts$success then signal vaxcondition(sts$value);
if iosb(1) ^=ss$_normal then signal vaxcondition(iosb(1));

/*perform the QIO to give the prompt*/
func = io$_readprompt|io$m_timed|io$m_noecho;

sts$value = sys$qiow(,
                     value(termch),
                     value(func),
                     reference(iosb),,,
                     reference(buffer),
                     10,5,,
                     ref(prompt),
                     65);

if ^sts$success then signal vaxcondition(sts$value);

if iosb(1) = ss$_normal
   then put skip list('you typed: ',substr(buffer,1,iosb(2)));
   else if IOSB(1) = ss$_controlc
        then put skip list('Request canceled due to ctrl/c');
        else if iosb(1) = ss$_timeout
              then put skip list('no response, timeout');
              else signal vaxcondition(sts$value);

end ctlcast1;


ctlcast2: proc(ttchan);
   %include $stsdef;
   %include sys$cancel;
   dcl ttchan fixed bin(15);

   put skip list('In the subroutine');

/* cancel I/O to the terminal*/
   sts$value = sys$cancel(ttchan);
   if ^sts$success then signal vaxcondition(sts$value);
   put skip list('from sub: control c was typed');
   end ctlcast2;




buy online or call 1.800.AT.COMPAQ
privacy statementusing this site means you accept its terms