TS/MP Pathsend and Server Programming Manual (G06.24+, H06.03+)
Examples
NonStop TS/MP Pathsend and Server Programming Manual–132500
B-34
Pathsend Requester Example
?PAGE "SEARCH THE CONTROL BLOCKS FOR I/O POSTED BUT NOT COMPLETED"
! I/O's were initiated out of control blocks. Here we step through
! the list of cb's and check for I/O that was initiated but not
! completed. If there are any outstanding I/O's, return true,
! otherwise return false.
INT PROC io^outstanding (cb^list^head);
INT .EXT cb^list^head (control^block^template); ! first element in cb list
BEGIN
INT .EXT cb (control^block^template) := @cb^list^head;
WHILE @cb <> nil^addr
DO
BEGIN
IF cb.io^posted
THEN ! yes, there is outstanding I/O
RETURN true;
@cb := @cb.next^cb;
END;
RETURN false;
END; ! PROC io^outstanding
?PAGE "OUTPUT THE RESULTS OF ONE TRANSACTION"
! This procedure moves data from the two Pathsend control blocks
! into the output buffer, and then writes the output buffer to the
! out file.
PROC output^the^results (cb^list^head);
INT .EXT cb^list^head (control^block^template);
BEGIN
INT .EXT cb (control^block^template) := @cb^list^head;
STRUCT .out^buf (breq^output^rec^template);
INT i := 0;
STR .EXT sp;
! Clear the output buffer
out^buf ':=' " " & out^buf FOR ($LEN (out^buf) + 1) / 2;
! Store the outcome of the two Pathsend sends into the output buffer
WHILE @cb <> nil^addr DO
BEGIN
IF cb.type = cb^type^pathsend
THEN ! this cb has data about the outcome of a Pathsend send
BEGIN