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

Examples
NonStop TS/MP Pathsend and Server Programming Manual132500
B-51
Pathsend Requester Example
! specified in the input record, and puts the process name
! associated with the ASSIGN into the PATHMON system and
! process name field of the input record.
IF validate^breq^input (input^buf)
THEN ! input record is valid
BEGIN
! A valid request record is in the format of
! breq^input^rec^template, and contains data needed to
! make 2 Pathsend sends. The data is a PATHMON name
! (either explicit or an ASSIGN) and a server class name.
! Allocate one control block (cb) each for the two
! Pathsend sends, and one cb for the message log write.
! The cb's are link listed together, and the head of the
! list is returned. Data stored in the cb's is from the
! input record.
@cb^list^head := setup^control^blocks (input^buf, record^number);
! Process^transaction starts the tmf transaction,
! initiates the I/O, completes the I/O, and ends the tmf
! transaction.
! If an I/O fails, then process^transaction aborts the tmf
! transaction, cancels the outstanding I/O, and returns
! false. In this case we will retry the transaction
! MAX-RETRIES times if the transaction is retryable.
retry^count := 0;
IF NOT process^transaction (cb^list^head)
THEN ! the transaction failed
BEGIN
! Retryable^transaction is a proc that returns true
! if all I/O that failed is retryable.
WHILE retry^count < max^retries AND
retryable^transaction (cb^list^head)
DO
BEGIN
CALL write^trace^file (trace^retry^transaction);
CALL process^transaction (cb^list^head);
retry^count := retry^count + 1;
END;
If retry^count >= max^retries
THEN
! the transaction failed after retrying max^retries times
CALL write^trace^file (trace^max^retries^exceeded);
END; ! if
END; ! input record is valid
! Write the output to the OUT file
CALL output^the^results (cb^list^head);
! Return all control block memory to the pool, and set the
! the first element in the list to nil address.