Guardian Programmer's Guide

Table Of Contents
Writing a Server Program
Guardian Programmer’s Guide 421922-014
22 - 25
The Part-Query Server ($SER1)
! Open $RECEIVE with a receive depth of 1 and to accept
! system messages (the default):
RECV^NAME ':=' "$RECEIVE" -> @S^PTR;
RECV^DEPTH := 1;
ERROR := FILE_OPEN_(RECV^NAME:@S^PTR '-' @RECV^NAME,
RECV^NUM,
!access!,
!exclusion!,
!nowait^depth!,
RECV^DEPTH);
! Instruct the operating system to send status change messages
! for processors in both local and remote systems.
CALL MONITORCPUS( -1 );
CALL MONITORNET( 1 );
! Open the INVENTORY file:
INV^FNAME ':=' "=INV^FNAME" -> @S^PTR;
INV^FLEN := @S^PTR '-' @INV^FNAME;
ERROR := FILE_OPEN_(INV^FNAME:INV^FLEN,INV^FNUM);
IF ERROR <> 0 THEN
CALL FILE^ERRORS^NAME(INV^FNAME:INV^FLEN,ERROR);
! Initialize the opener table:
I := 1;
WHILE I <= MAX^OPENERS DO
BEGIN
OPENER^TABLE.OCB[I].PROCESS^HANDLE ':='
[ ZSYS^VAL^PHANDLE^WLEN * [-1] ];
OPENER^TABLE.OCB[I].RESERVED^HANDLE ':='
[ ZSYS^VAL^PHANDLE^WLEN * [-1] ];
I := I + 1;
END;
END;