6100 BSC Programming Manual
 BSC Example
?PAGE "COMM COMPLETION - COMM^COMPLETE"
!*********************************************************************
!
! Function: upon completion of the outstanding read, data is moved
! to the term^buff and post a new read on the line to send
! an ACK and receive the EOT. (you may have another block
! to receive in your program).
! It then writes the received data to the terminal and posts
! a new read on the line (an AWAITIO is owed to this
! last WRITEREAD).
!
! Called by : MAIN, TERM^COMPLETE
!
! calling : WRITE^TERM, CLIP^STATUS^HANDLER
!
!*********************************************************************
PROC COMM^COMPLETE(COUNT); INT COUNT;
BEGIN
 INT error;
 STRING status = error;
 s^term^buff ':=' s^cpline^text^buffer[1] FOR (count := count - 10);
 s^cpline^buffer.clip^req^hdr.func ':=' clip^read^req for 2;
 reqid := (reqid '+' 1); !GET THE NEXT
 cpline^buffer.clip^req^hdr.reqid := reqid; !READ OUT TO
 cpline^buffer.clip^req^hdr.txtin^len := cpline^text^len; !ACK AND GET
 CALL WRITEREAD (comm^file, cpline^buffer,clip^req^hdr^len, !NEXT BLOCK.
 max^comm^read,cpline^cnt^recvd); !(EOT IN THIS
 ! EXAMPLE)
 CALL AWAITIO(comm^file);
 error := 0;
 status [1] := cpline^buffer.clip^rsp^hdr.status; !IF NOT AN EOT
 IF ERROR <> EOT^RECEIVED THEN !IT'S A PROBLEM
 CALL clip^status^handler(term^buff)
 ELSE
 CALL WRITE^TERM(term^buff, COUNT); !DISPLAY MSG.
 s^cpline^buffer.clip^req^hdr.func ':=' clip^read^req for 2;
 reqid := (reqid '+' 1); !POST ANOTHER
 cpline^buffer.clip^req^hdr.reqid := reqid; !READ AND GO
 cpline^buffer.clip^req^hdr.txtout^len := 0; !BACK WHERE YOU
 cpline^buffer.clip^req^hdr.txtin^len := cpline^text^len; !CAME FROM.
 CALL WRITEREAD (comm^file, cpline^buffer,clip^req^hdr^len,
 max^comm^read,cpline^cnt^recvd);
! ********* one AWAITIO owed to this WRITEREAD
END; !COMM^COMPLETE
 B-13










