TS/MP Pathsend and Server Programming Manual (G06.24+, H06.03+)
Examples
NonStop TS/MP Pathsend and Server Programming Manual–132500
B-32
Pathsend Requester Example
?PAGE "START A WRITE OF THE INPUT REQUEST RECORD TO THE MSG LOG"
! This proc is called from initiate^IO, and starts the I/O to the
! message log file. The WRITE is tagged so we can identify this I/O
! when completing it with AWAITIOX, or cancelling it with CANCELREQ.
! If the WRITE fails, we will not return.
INT PROC initiate^write^to^message^log (cb);
INT .EXT cb (control^block^template);
BEGIN
INT error := 0;
CALL WRITEX (msg^log^fnum, cb.input^data^buf, $LEN(cb.input^data^buf),, @cb);
IF <
THEN ! error occurred on the write
BEGIN
CALL FILEINFO (msg^log^fnum, error);
IF <>
THEN ! couldn't access the ACB
CALL abend^with^my^abend^msg;
! Print an error message and abend
CALL IO^error (msg^log^fnum);
END;
! I/O successfuly initiated
cb.io^posted := true;
cb.fnum := msg^log^fnum;
CALL write^trace^file (trace^write^to^msg^log, cb.record^number);
RETURN true;
END; ! INT PROC initiate^write^to^message^log
?PAGE "WRITE AN ERROR MSG TO THE ERROR LOG"
! This procedure is passed a file number and gets the file system
! error and file name associated with that file number. It builds an
! error msg and writes it to either the error log file or the home
! terminal. This PROC calls ABEND.
PROC IO^error (fnum);
INT fnum;
BEGIN
INT .buf [0:79];
STR .sbuf := @buf '<<' 1;
STR .sp;
INT .filename [0:11];
INT len;
INT error;
INT OutFnum;
! If an OPEN failed, fnum is -1 and FILEINFO will return the error
! associated with the failed OPEN. The file name param, in this
! case, will be invalid.
CALL FILEINFO (fnum, error, filename);
IF <>
THEN ! couldn't access the ACB