Guardian Programmer's Guide

Table Of Contents
Writing a Server Program
Guardian Programmer’s Guide 421922-014
22 - 46
The Process-Order Server ($SER2)
! Open the orders file:
ORD^FNAME ':=' "=ORD^FNAME" -> @S^PTR;
ORD^FLEN := @S^PTR '-' @ORD^FNAME;
ERROR := FILE_OPEN_(ORD^FNAME:ORD^FLEN,ORD^FNUM);
IF ERROR <> 0 THEN
CALL FILE^ERRORS^NAME(ORD^FNAME:ORD^FLEN,ERROR);
! 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;