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

Examples
NonStop TS/MP Pathsend and Server Programming Manual132500
B-23
Pathsend Requester Example
?PAGE "CREATE THE CONTROL BLOCK MEMORY POOL"
! This procedure uses the standard memory management routines to
! declare a memory pool starting at the upper 32K, with a size of
! 32K bytes.
! Control blocks (cb's) are managed as a linked list, and new cb's
! are allocated in get^control^block.
PROC create^the^memory^pool;
BEGIN
INT status;
INT .buf [0:79];
STR .sbuf := @buf '<<' 1;
STR .sp;
IF (status := DEFINEPOOL (PoolHead, pool, PoolSize))
THEN ! some memory allocation problem
BEGIN
sbuf ':=' "DEFINEPOOL FAILED TO CREATE THE MEMORY POOL" -> @sp;
CALL WRITE (error^log^fnum, buf, @sp '-' @sbuf);
IF <
THEN ! print an error msg and abend
CALL IO^error (error^log^fnum);
CALL ABEND;
END;
END; ! PROC create^the^memory^pool
?PAGE "END THE TMF TRANSACTION"
! End the transaction I started, and log the outcome to the error
! log file. If successful, write a record to the trace file.
PROC end^the^tmf^transaction;
BEGIN
INT tmf^error;
INT .buf [0:79];
STR .sbuf := @buf '<<' 1;
STR .sp;
IF (tmf^error := ENDTRANSACTION)
THEN ! file sys error in tmf^error
BEGIN
sbuf ':=' "ERROR WITH ENDTRANSACTION: " -> @sp;
CALL NUMOUT (sp, tmf^error, 10, 3);
@sp := @sp[3];
CALL WRITE (error^log^fnum, buf, @sp '-' @sbuf);
IF <
THEN ! print an error msg and abend
CALL IO^error (error^log^fnum);
CALL ABEND;
END;
! Successfully ended the transaction
CALL write^trace^file (trace^end^transaction);