6100 BSC Programming Manual
BSC Example
?page "MAIN PROCEDURE - CP6100^EXAMPLE"
!*******************************************************************
!
! MAIN : This procedure initializes the CP6100 BSC point to point
! line and the user terminal.
! One outstanding AWAITIO for the completion by either
! device. Data entered thru the terminal will be sent
! to the remote terminal via the 6100 BSC line.
! Data received from the remote terminal will be displayed
! on the user terminal.
! In case of errors on the line, display message, reprompt
! terminal and post a new read.
!
!*******************************************************************
PROC CP6100^EXAMPLE MAIN;
BEGIN
INT ERROR, COUNT;
string status = error;
CALL INITIALIZE;
WHILE 1 DO
BEGIN ! ***** of do forever until CONTROL^Y
FILE := -1;
CALL AWAITIO(FILE,,count); ! ***** this is the AWAITIO owed elsewhere
CALL FILEINFO(file,error);
IF FILE = term^file THEN
IF ERROR THEN CALL CHECK^TERM^ERROR(ERROR)
ELSE
BEGIN
IF COUNT THEN CALL TERM^COMPLETE(COUNT);
term^buff ':=' "? ";
CALL WRITEREAD(term^file, term^buff, 1, max^term^read);
IF < THEN CALL DEBUG;
END
ELSE
IF FILE = comm^file THEN
BEGIN ! ***** COMM I/O completed
IF error THEN CALL DEBUG; ! **** file level error
error := 0;
status [1] := cpline^buffer.clip^rsp^hdr.status;
IF ERROR THEN ! **** CLIP status error
BEGIN
IF error <> OPERATION^TIMED^OUT AND !INITIAL READ
error <> EOT^RECEIVED THEN
BEGIN
CALL clip^status^handler(term^buff);
term^buff ':=' "? ";
CALL WRITEREAD(term^file, term^buff, 1, max^term^read);
IF < THEN CALL DEBUG;
END;
s^cpline^buffer.clip^req^hdr.func ':=' clip^read^req for 2;
reqid := (reqid '+' 1);
B-22