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

Examples
NonStop TS/MP Pathsend and Server Programming Manual132500
B-38
Pathsend Requester Example
! Step through the list of control blocks (cb's), initiating the I/O
! associated with each cb (a send or a write).
WHILE @cb <> nil^addr DO
BEGIN
IF NOT initiate^IO (cb)
THEN ! failed to start the operation, treat error as non-retryable
BEGIN
CALL cancel^outstanding^io (cb^list^head);
CALL abort^tmf^transaction;
RETURN false;
END;
! Successfully started the I/O for this cb, goto next cb
@cb := @cb.next^cb;
END; ! while
! IO^Outstanding is a proc that steps through the list of cb's
! checking for I/O that has been posted but not yet completed.
WHILE io^outstanding (cb^list^head) DO
BEGIN
! Complete^IO returns @cb if the I/O completed successfully,
! otherwise it returns the nil address.
@cb := complete^io;
IF @cb = nil^addr
THEN ! an I/O failed
BEGIN
CALL cancel^outstanding^io (cb^list^head);
CALL abort^tmf^transaction;
RETURN false;
END;
! I/O completed successfully, check the reply buffer
IF cb.type = cb^type^pathsend !pathsend control block!
AND cb.pathsend^reply^buf.reply^code <> 0 !reply from server!
THEN ! we expect the reply code to be 0
CALL abend^with^my^abend^msg;
END; ! while
! Transaction completed successfully
CALL end^the^tmf^transaction;
RETURN true;
END; ! INT PROC process^transaction
?PAGE "READ FROM AN EDIT FILE"
! This procedure reads one line from the IN file.
! It returns the outcome of the read to the caller, with the
! variable error containing the error associated with the read.
INT PROC read^ (fnum, buf, read^count, error);
INT fnum;
STR .buf;