SNAX Connection Manager (SNAX/CM) Manual

User Process Procedures
SNAX/CM Sample Server
C–16 097842 Tandem Computers Incorporated
ELSE
BEGIN -- OPEN succeeded
-- build and send the start up message
newp^smsg.msg^code := -1;
newp^smsg.default ':=' proc^buf.file2 FOR 8 WORDS;
newp^smsg.infile ':=' proc^buf.file1 FOR 12 WORDS;
newp^smsg.parms ':=' "line " -> @sptr1;
lu^name^len := fnamecollapse( luexpname,sptr1 );
@sptr1 := @sptr1 '+' lu^name^len;
IF proc^buf.parmstring.length THEN
sptr1 ':=' ","&
proc^buf.base[ proc^buf.parmstring.offset ] FOR
proc^buf.parmstring.length BYTES;
CALL write( procfn,
newp^smsg,
$OFFSET( newp^smsg.parms ) + 5 + lu^name^len +
proc^buf.parmstring.length );
CALL fileinfo( procfn ,error );
IF (error <> fecontinue) THEN
BEGIN -- WRITE of startup msg failed
errmsg ':=' "WRITE startup message failed for LU: " -> @sptr1;
@sptr1 := @sptr1 + fnamecollapse( luexpname, sptr1 );
CALL writeterm_( @sptr1 '-' @errmsg );
errmsg ':=' "File Error: " -> @sptr1;
CALL numout(sptr1, error, 10, 4 );
@sptr1 := @sptr1 + 4;
CALL writeterm_( @sptr1 '-' @errmsg );
CALL STOP ( proc^id );
END -- WRITE of startup msg failed
ELSE
BEGIN -- WRITE of startup msg succeeded
CALL close(procfn);
errmsg ':=' "NEWPROCESS successful for LU: " -> @sptr1;
@sptr1 := @sptr1 + fnamecollapse( luexpname, sptr1 );
CALL writeterm_( @sptr1 '-' @errmsg );
IF ( @connect^buf := getpool( xpoolhead,
$DBL( $len( connected^buffer^template ) +
4 !proc^name length! ) ) ) > 0d THEN
BEGIN -- buffer is available
connect^buf.type := 1; -- user^type
connect^buf.linename ':=' luexpname FOR 4 WORDS;
connect^buf.parm.offset :=
$OFFSET( connected^buffer^template.data );
connect^buf.base[ connect^buf.parm.offset ] ':='
proc^id^string FOR 8 BYTES;
connect^buf.parm.length := 8;
RETURN @connect^buf;
END -- buffer is available
ELSE
BEGIN -- the thing is running, but we have no record
RETURN 0D;
END; -- the thing is running, but we have no record
END; -- WRITE of startup msg succeeded
END; -- OPEN succeeded
END; -- NEWPROCESS successful
RETURN 0D;
END; -- do^user2^connect
INT PROC do^user2^disconnect( connect^buf, errmsg, xpoolhead );
INT .EXT connect^buf( connected^buffer^template );
STRING .errmsg;
INT .xpoolhead;
BEGIN -- do^user1^disconnect
RETURN true; -- EXCHANGE closes down without CM help
END; -- do^user1^disconnect