6100 ADCCP Programming Manual
ADCCP Programming Example Using Transaction Application Language (TAL)
069225 Tandem Computers Incorporated B–11
?PAGE "NonStop Procedures: PROC CHECK"
!
!This procedure is used to perform all checkpoints. It contains the
!logic to handle takeover situations.
!
PROC CHECK (BASE);
INT .BASE;
BEGIN
int status;
while (status:=checkpoint(base,,recfile,,outfile,,rfnum,,wfnum,,asynfnum)).<0:7>=2 do
begin
if createbackup(backupcpu,backupcrtpid) then
sbuf[28] ':=' ", Backup started." -> @ptr
else sbuf[28] ':=' ", Backup not started!!" -> @ptr;
call stamp^msg(sbuf);
sbuf[9] ':=' "Take Over by CPU ";
call numout(sbuf[26],mypid.<0:7>,10,2);
call readupdate(recfile,recbuff,rec^io^size);
if <> then call abend^;
call write(outfile,outbuf,@ptr '-' @sbuf);
call awaitio(outfile);
end;
return
END; !CHECK
!
?PAGE "NONSTOP^WHOAMI"
!NONSTOP^WHOAMI - Determine if backup or primary process.
!
proc nonstop^whoami;
begin
struct .ppd;
begin
int name[0:2],
pid1,
pid2,
ancestor[0:3];
end;
!
!Obtain the process-pair directory entry (ppd).
!
if not (error := processinfo(mypid,ppd)) then
begin
call lookupprocessname(ppd);
if <> then call abend^;
end
else call debug;
!
!Determine if backup or primary process. If backup, call checkmonitor.
!If primary, return to do what a primary does.
!
if ppd.pid2 <> 0 then !we are the backup.
begin
go^back := go^back + 1;
backupcpu := ppd.pid1.<0:7>;
call monitorcpus(%100000 '>>' ppd.pid1.<0:7>);
call checkmonitor;
call abend^; !should not come here
end;
!
! We are the primary.
!
go^prime := go^prime + 1;
return;
end;
?page "SBLANK PROCEDURE"
proc sblank(str,bytes);