GDSX Manual

LINE^HANDLER Example, Design
Extended General Device Support (GDSX) Manual134303
7-10
Basic Structure of LINE^HANDLER Code
Receipt of an intertask message is one of the events tested for with the CASE
WAIT^EVENT statement (see Figure 7-4). Then a perpetual loop is initiated with logic
to determine what kind of event has happened. A CASE statement tests the event literal
returned from WAIT^EVENT and determines which of four expected events have
occurred. In this example, events tested for are:
E^ITC, intertask message from DEVICE^HANDLER
E^IOC, I/O completion on a file, most likely the LINE file
Figure 7-4. Basic Structure of LINE^HANDLER Code
^WT
TERM
INIT
PROCESSING
^READUPDATE
(IN^Q^FILE)
WHILE (1)
DO
CASE
WAIT^EVENT
E^ITC E^IOC E^CAN E^STOP
@IOCB :=
^LISTEN(...
@IOCB :=
^LISTEN(...
Find
Cancelled
IOCB
CALL
STOP^TASK
Send I/O
To Line
Process I/O
Completion
CALL
NOTIFY^IO^
COMPLETION
^READUPDATE
(IN^Q^FILE)
CALL
NOTIFY^IO^
COMPLETION
Cancel Line
Operation
Release
Line IOCB
^READUPDATE
(IN^Q^FILE)