Guardian Programmer's Guide

Table Of Contents
Writing a Server Program
Guardian Programmer’s Guide 421922-014
22 - 24
The Part-Query Server ($SER1)
!------------------------------------------------------------
! Procedure to save the Startup message.
!------------------------------------------------------------
PROC START^IT(RUCB,START^DATA,MESSAGE,LENGTH,
MATCH) VARIABLE;
INT .RUCB,
.START^DATA,
.MESSAGE,
LENGTH,
MATCH;
BEGIN
! Copy the Startup message into the START^UP^MESSAGE
! structure and save the message length:
START^UP^MESSAGE.MSG^CODE ':=' MESSAGE[0] FOR LENGTH/2;
MESSAGE^LEN := LENGTH;
END;
!------------------------------------------------------------
! 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 .INV^FNAME[0:MAXFLEN - 1]; !data 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_;