6100 ADCCP Programming Manual

ADCCP Programming Example Using Transaction Application Language (TAL)
B–20 069225 Tandem Computers Incorporated
?page
!
proc put^suppress^msg;
begin
string .ptr2;
call stamp^msg(sbuf); !place a time stamp in sbuf[0:8]
sbuf[9] ':=' "Suppressed " -> @ptr2;
call numout(sbuf[@ptr2 '-' @sbuf],suppress^count,10,5);
ptr2[5] ':=' ": " -> @ptr2;
ptr2 ':=' suppress^buf for suppress^length -> @ptr2;
call write(outfile,outbuf,@ptr2 '-' @sbuf);
call awaitio(outfile);
suppress^count := 0;
suppress^buf ':=' " " & suppress^buf for suppress^length - 1;
return;
end;
?page
!
!On entry: sbuf contains the message
!ptr -> next free byte of message
!error <> 0 means to NUMOUT the error at ptr.
!
This procedure writes error messages, asynchronous responses, etc., on the terminal.
proc write^err^msg;
begin
int i;
string .temp^buf[0:80];
if error then !Note: ERROR is preset by the caller
begin
call numout(sbuf[@ptr '-' @sbuf],error,10,4);
@ptr := @ptr[4];
end;
i := @ptr '-' @sbuf[9]; !length of message (excluding the timestamp portion)
call stamp^msg(sbuf); !place time stamp in message, also sets current^time
if suppress^count then
if suppress^buf '=' sbuf[9] for i then
begin !suppress another error msg
if (suppress^count := suppress^count + 1) = 32767
or (current^time-save^time) > 180D !seconds! then
call put^suppress^msg;
return;
end
else !a different error
begin
temp^buf ':=' sbuf[9] for i;
call put^suppress^msg;
sbuf[9] ':=' temp^buf for i;
end
else if suppress^buf '=' sbuf[9] for i then
begin
suppress^count := 1;
save^time := current^time;
return;
end;
save^time := current^time;
suppress^buf ':=' sbuf[9] for i;
suppress^length := i;
call write(outfile,outbuf,i + 9);
call awaitio(outfile);
return;
end;