GDSX Manual

LINE^HANDLER Example, Design
Extended General Device Support (GDSX) Manual134303
7-15
LINE^HANDLER Procedure
If there is an I/O on the LINE file, there is an IOCB address on the WRITEREAD IOCB
queue. Therefore, if the value of oldest is equal to the value of newest, the queue is
empty, and the LINE file must be free.
INCR^INDEX is a subroutine that simply increments an index to the WRITEREAD
IOCB queue; if the value of the parameter supplied is 14, 0 is returned.
I/O Operations to the LINE File
Example 7-4 shows the code for the WT^TO^LINE and WR^RD^TO^LINE
subprocedures. The WHILE statement deletes from the queue all items with a value of
0, which indicates a canceled request, as discussed in “Cancel^ITC Procedure” on
page 7-18.
Example 7-3. PROCESS^DH^REQ Subprocedure
SUBPROC PROCESS^DH^REQ;
BEGIN
@DH^IOCB := ^LISTEN(0,0,1); ! PICK UP REQUEST FROM D^H
IF @DH^IOCB = 0D THEN RETURN;
CASE DH^IOCB.OPTYPE OF
BEGIN
WT^RD^OP -> ! PUT A NEW WT^RD REQUEST ON THE LIST
BEGIN
WT^RD^IOCB^LIST[NEWEST] := @DH^IOCB;
IF (OLDEST = NEWEST) THEN ! NO OTHER
! WT^RD IS OUTSTANDING
BEGIN
CALL INCR^INDEX(NEWEST);
CALL WT^RD^TO^LINE;
END
ELSE
CALL INCR^INDEX(NEWEST);
END;
WT^OP ->
BEGIN
@WT^IOCB := @DH^IOCB; ! SAVE IOCB FROM WRITE OP
! (REQUESTER DESIGN ENSURES THAT NO MORE THAN
! ONE WILL BE OUTSTANDING)
CALL WT^TO^LINE;
END;
OTHERWISE ->
CALL DEBUG;
END; ! CASE
END; ! SUBPROC