6100 ADCCP Programming Manual

ADCCP Programming Example Using Transaction Application Language (TAL)
069225 Tandem Computers Incorporated B–27
if (out^key := out^key + 1) = 32767 then out^key := 0;
end;
This procedure posts RECEIVETEXT and SENDTEXT requests.
subproc post^ios;
begin
int .wbuf,i,loop^cnt;
if not read^posted then
begin
if first^time
If these are the first I/O requests to be posted after the link is established, the
program posts 3 RECEIVETEXT requests. The first request has a tag of 1, the
second has a tag of 2, and the third has a tag of 3.
THEN BEGIN
loop^cnt := 3;
BEGIN
for i := 1 to loop^cnt do
begin
RTAG := $DBL(i);
call sblank(d,iosize+$LEN(d.basic));
The first request is a special form, with a modifier of 255; it flushes ADCCP's read
queues. Note that in a RECEIVETEXT request, the Text In value is 0. ADCCP
ignores it and accepts as much data as the frame size will allow.
if i = 1 then
call recflush(rfnum,,255,0,0,ltf^rcvtext,iosize+$LEN(d.basic),RTAG)
else
call receive(rfnum,,0,0,ltf^rcvtext,iosize+$LEN(d.basic),RTAG);
end;
END; !END OF DO LOOP
END !END OF FIRST^TIME BEING TRUE
If this is not the beginning of the session, the program posts one RECEIVETEXT
request.
else begin
IF EXP^CNT = 1 THEN RTAG := $DBL(3)
ELSE RTAG :=$DBL(exp^cnt -1);
call sblank(d,iosize+$LEN(d.basic));
call receive(rfnum,,0,0,ltf^rcvtext,iosize+$LEN(d.basic),RTAG);
end;
The next RECEIVETEXT request to complete should have a tag equal to exp^cnt.
(See subproc frame^in, below.)
if first^time then exp^cnt := 1;
first^time := false;
read^posted := true;
end;
@wbuf := buf^ptrs[write^dex];
If there is no SENDTEXT posted, the program posts a SENDTEXT. The tag is a
number from 0 to 5; the first frame sent has a tag of 0, the second has a tag of 1, and
so on. The value of the tag wraps around after 5.
while not write^posted do
begin
call build^buf(wbuf);
itag[0] := 0;