Guardian Programmer's Guide

Table Of Contents
Writing a Server Program
Guardian Programmer’s Guide 421922-014
22 - 45
The Process-Order Server ($SER2)
!------------------------------------------------------------
! Procedure to perform initialization. It calls INITIALIZER
! to read the Startup message then opens the IN file, the
! inventory file, and $RECEIVE, and then initializes the
! opener table.
!------------------------------------------------------------
PROC INIT;
BEGIN
STRING .TERM^NAME[0:MAXFLEN - 1]; !terminal file name
INT TERMLEN;
STRING .RECV^NAME[0:MAXFLEN - 1]; !$RECEIVE file name
STRING .ORD^FNAME[0:MAXFLEN - 1]; !orders file name
INT ORD^FLEN;
STRING .INV^FNAME[0:MAXFLEN - 1]; !inventory file name
INT INV^FLEN;
INT RECV^DEPTH; !receive depth
INT I;
INT ERROR;
! Read the Startup message:
CALL INITIALIZER(!rucb!,
!passthru!,
START^IT);
! Open the home terminal (IN file);
ERROR := OLDFILENAME_TO_FILENAME_(START^UP^MESSAGE.INFILE,
TERM^NAME:MAXFLEN,
TERMLEN);
IF ERROR <> 0 THEN CALL PROCESS_STOP_;
ERROR := FILE_OPEN_(TERM^NAME:TERMLEN,TERM^NUM);
IF ERROR <> 0 THEN CALL PROCESS_STOP_;
! 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 );