6100 ADCCP Programming Manual

ADCCP Programming Example Using Transaction Application Language (TAL)
069225 Tandem Computers Incorporated B–31
out^KEY := 0
ELSE out^KEY := out^KEY + 1;
end; !END OF SUBPROCEDURE
This subprocedure prints a pair of messages every 30 seconds to tell how many
frames have been sent and received.
subproc timed^out;
begin
sbuf[9] ':=' "Timeout." -> @ptr;
call write^err^msg;
end;
?page
subproc see^if^30^seconds^has^passed;
begin
int max^time[0:1] := [%77777,-1];
int(32) max = max^time,
time^passed;
call timestamp(now^time);
start^time[1].<0> := 0; !turn off sign bit of "start"
now^time[1].<0> := 0; !turn off sign bit of "now"
if (time^passed := now - start) < 0D then
time^passed := max + time^passed;
if time^passed >= 3000D then
begin !30 seconds has passed
if suppress^count then call put^suppress^msg;
call numout(sbuf[9],records^read,10,5);
sbuf[14] ':=' " records of " -> @ptr;
call numout(ptr,(framesize - 1) '<<' 1,10,4);
ptr[4] ':=' " bytes each were read." -> @ptr;
call write^err^msg;
call numout(sbuf[9],records^written,10,5);
sbuf[14] ':=' " records of " -> @ptr;
call numout(ptr,(framesize - 1) '<<' 1,10,4);
ptr[4] ':=' " bytes each were written." -> @ptr;
call write^err^msg;
start^time ':=' now^time for 3;
records^read := records^written := 0;
end;
end;
?page "MAIN of MAIN"
!
! <<< MAIN >>>
!
Open files and initialize buffers.
call startup;
call sblank(rbuf,30);
call setmode(asynfnum,30,1);
Prepare to receive asynchronous messages.
CALL READ(ASYNFNUM,RBUF,$LEN(D.BASIC));
if < then call fileinfo(asynfnum,error);
call check(base);
Set the configuration and start the line.
if not setmode^line then call abend^; !crash if unable to SETMODE the line
session := false; !line is ready but no session yet.
iosize := framesize '<<' 1; !bytes