6100 ADCCP Programming Manual

ADCCP Programming Example Using Transaction Application Language (TAL)
B–28 069225 Tandem Computers Incorporated
itag[1] := write^dex;
d.command^response.txt[1] ':=' write^mcw for iosize/2 ;
call receive(wfnum,,iosize,0,ltf^sendtext,$LEN(d.basic),tag);
write^posted := true;
if write^dex = 5 then
write^dex := 0
else write^dex := write^dex + 1;
@wbuf := buf^ptrs[write^dex];
end;
end;
!
The main procedure calls frame^in after a RECEIVETEXT completes.
subproc frame^in;
begin
int length^left,IPTR;
The tag is compared to the expected value. Then, exp^cnt is increased by 1 to match
the next expected tag. If the tag does not match the expected value, the program
reports an error and discontinues the session.
if inttag = exp^cnt then
begin
if exp^cnt = 3 then exp^cnt := 1
else exp^cnt := exp^cnt + 1;
end
else
begin
sbuf[9]':='"??? READ TAG invalid"->@ptr;
call write^err^msg;
session := false;
read^posted := false;
return;
end;
If no file-system error occurred, the program ensures that the function was
RECEIVETEXT and that it completed successfully. A 0 in the second byte of the
buffer means that the P/F bit was off; a 128 means that it was on (but both are
successful completions). If a file-system error occurred or if the buffer contained an
error code, the program reports an error to the user and discontinues the session.
if not error then
IF NOT (D.COMMAND^RESPONSE.RSP = ltf^RCVTEXT and
D.COMMAND^RESPONSE.MOD = LTM^OK OR
D.COMMAND^RESPONSE.MOD = 128 AND
D.COMMAND^RESPONSE.REQ^ID = ltf^RCVTEXT)
then BEGIN
ERROR := 300;
ERROR.<8:15> := ERROR.<8:15> + D.COMMAND^RESPONSE.MOD;
END;
IF ERROR THEN
BEGIN
sbuf[9] ':=' "READ ERROR: " -> @ptr;
call write^err^msg;
session := false;
read^posted := false;
return;
end;