TS/MP Pathsend and Server Programming Manual (G06.24+, H06.03+)
Examples
NonStop TS/MP Pathsend and Server Programming Manual–132500
B-36
Pathsend Requester Example
! Store non-Pathsend error messages generated by this program
out^buf.non^send^error^msg ':=' global^non^pathsend^error^msg
FOR $OCCURS (out^buf.non^send^error^msg);
! Write the record to the output file
CALL WRITE (out^fnum, out^buf, $LEN (out^buf));
IF <>
THEN ! print an error msg and abend
CALL IO^error (out^fnum);
END; ! PROC output^the^results
?PAGE "PROCESS THE PARAM MSGS"
! This procedure is called by GUARDIAN 90 PROC INITIALIZER from PROC
! initialize to save the PARAM MAX-RETRIES and store into variable
! MAX-RETRIES.
PROC param^proc (rucb, passthru, param^msg, msg^len, match) VARIABLE;
INT .rucb;
INT .passthru;
INT .param^msg (ci^param);
INT msg^len;
INT match;
BEGIN
INT .buf [0:79];
STR .sbuf := @buf '<<' 1;
INT i := 0, found := false;
STR .sp, .st;
INT status;
INT early^exit := false;
! Unlike ASSIGNs, we receive all the PARAMs in a single
! PARAM msg.
@sp := @param^msg.parameters;
! The early^exit flag is used to exit the loop if the parameter has
! an invalid value specified. The found flag is used to exit the
! loop if the param is found and has a valid value.
WHILE (i := i + 1) <= param^msg.num^params AND NOT found AND NOT early^exit
DO
BEGIN
IF sp[1] = "MAX-RETRIES"
THEN ! found the param
BEGIN
sbuf ':=' sp[sp + 2] FOR sp[sp + 1] -> @st;
st := 0;
CALL NUMIN (sbuf, max^retries, 10, status);
IF status
THEN ! illegal value
BEGIN
max^retries := -1;
early^exit := true;
END
ELSE
found := true;
END;