GDSX (Extended General Device Support) Manual

Design and Development
Extended General Device Support (GDSX) Manual529931-001
2-103
The LINE^HANDLER Procedure
on the slow poll list are placed back on the poll list by a CHANGELIST(.., -2,..) call.
As the line is now idle, a call is made to CHECK^CANCELS to get rid of any canceled
IOCBs.
If no error occurred on the READ operation, some subdevice responded to the poll. A
call to the subprocedure FIND^DCB locates the DCB corresponding to this subdevice.
FIND^DCB returns 1 if the DCB is located, and 0 otherwise. If 1 is returned,
FIND^DCB has also set adcb to point to the proper DCB and aiocb to point to the
IOCB for the READ request.
Aiocb.bufaddr is examined to see whether the DEVICE^HANDLER task passed a
buffer to ^READ. If it did not, a buffer is allocated and given to the task. Note that if
the buffer owner is not changed, aiocb.bufaddr is reset, and the users request is
completed with file error 31 (FENOBUFSPACE) instead of trapping the
LINE^HANDLER. This is done to handle the case where the DEVICE^HANDLER task
requesting this I/O terminates during the wait for a buffer.
Assuming that a buffer is allocated, the text portion of the received message is moved
into that buffer. In the process:
The variable ab is set to point to the user’s buffer.
The variable asb is set to point to the next available byte in the buffer.
If an error other than 176 has occurred on the read, there is an attempt to dump the
error on the reader of the device.
To wrap up processing, the IOCB associated with the Envoy READ operation is
deallocated and a result is returned:
If no error occurred, another READ is posted on the line. When this READ completes,
the subprocedure CONTINUATION^READ is called. CONTINUATION^READ ensures
that aiocb is nonzero, then determines if an EOT was received from the device. If it
was, the number of bytes read is stored in aiocb.iocnt, and the request is completed. If
no error occurred, another block of this input message has been received. Using asb,
the text from this message is appended to the end of the user’s buffer. In this case,
another read is initiated on the line and CONTINUATION^READ is called again. If an
error occurred on the read, the user task’s READ request is completed to return the
error.
Note. If this LINE^HANDLER is to be used in a production environment, handling of the slow
poll list should be improved.
0 Error other than 176 occurred
1 Error 176
2 No error