Guardian Programmer's Guide

Table Of Contents
Writing a Server Program
Guardian Programmer’s Guide 421922-014
22 - 29
The Process-Order Server ($SER2)
with the new (negative) stock level; the inventory file does not get updated
because the requester process uses the negative number to reject the order
request.
If there is enough stock on hand to satisfy the request, then the
PROCESS^USER^REQUEST procedure creates an order record out of the
information sent by the requester, adds the date of the order to the structure, and
then writes the new record to the orders file.
The Code for the Process-Order Server ($SER2)
The code for the process-order server program appears on the following pages.
?INSPECT, SYMBOLS, NOCODE
?NOLIST, SOURCE $TOOLS.ZTOOLD04.ZSYSTAL
?LIST
!-----------------------
!Literals:
!-----------------------
LITERAL MAX^OPENERS = 2, !maximum number of openers
! allowed
EXACT = 2, !for exact key positioning
MAXFLEN = ZSYS^VAL^LEN^FILENAME,
!maximum length for file name
BUFSIZE = 512;
!------------------------
!Global data structures:
!------------------------
!Data structure for Startup message:
STRUCT .START^UP^MESSAGE;
BEGIN
INT MSG^CODE;
STRUCT DEFAULT;
BEGIN
INT VOLUME[0:3];
INT SUBVOLUME[0:3];
END;
STRUCT INFILE; !IN file name
BEGIN
INT VOLUME[0:3];
INT SUBVOLUME[0:3];
INT FILENAME[0:3];
END;
STRUCT OUTFILE; !OUT file name
BEGIN
INT VOLUME[0:3];
INT SUBVOLUME[0:3];
INT FILENAME[0:3];
END;