TS/MP Pathsend and Server Programming Manual (G06.24+, H06.03+)

Examples
NonStop TS/MP Pathsend and Server Programming Manual132500
B-28
Pathsend Requester Example
! The trace file contains a log of specific events that occurred in
! BREQ, e.g., a PATHSEND send or ENDTRANSACTION.
logical^name ':=' "TRACE-FILE ";
IF (@assign^ := get^assign (logical^name, 10))
THEN ! optional assign, use if included
BEGIN
CALL FNAMECOLLAPSE (assign^.tandemfilename.volume, trace^file);
CALL FNAMEEXPAND (trace^file, trace^file, startup^msg.default);
CALL OPEN (trace^file, trace^fnum, open^write^only LOR
open^shared, retry^path^failures);
IF <>
THEN ! open failed
BEGIN
sp ':=' "FAILED TO OPEN TRACE FILE" ->@st;
CALL WRITE (term^fnum, buf, @st '-' @sp);
IF <
THEN ! print an error msg and abend
CALL IO^error (term^fnum);
CALL IO^error (trace^fnum);
END;
! By sharing the same terminal as the CI, which uses BREAK, we
! gain BREAK access to the term with SETMODE 12 (set file
! type access, param 2 = 1). File access is BREAK access.
CALL DEVICEINFO (trace^file, devtype, phys^reclen);
IF devtype.<4:9> = 6 ! Type TERM!
THEN ! Do a setmode so we can write to it.
CALL SETMODE (trace^fnum, 12, 0, 1);
END
ELSE ! trace assign not present, so don't trace
trace^fnum := -1;
CALL OPEN (error^log^file, error^log^fnum, open^write^only LOR
open^shared, retry^path^failures);
IF <>
THEN ! open failed
BEGIN
sp ':=' "FAILED TO OPEN ERROR LOG FILE" ->@st;
CALL WRITE (term^fnum, buf, @st '-' @sp);
IF <
THEN ! print an error msg and abend
CALL IO^error (term^fnum);
CALL IO^error (error^log^fnum);
END;