Guardian Programmer's Guide

Table Of Contents
Writing a Server Program
Guardian Programmer’s Guide 421922-014
22 - 37
The Process-Order Server ($SER2)
! Requester not in opener table:
BEGIN
REPLY^LEN := 0;
REPLY^ERROR := 60;
RETURN
END;
I := I + 1;
END;
! Proceed because the requester is in the opener table.
!-----------------------------
!Update inventory record with
!new quantity on hand and
!prepare the reply structure
!with new quantity information
!-----------------------------
! Copy user message from requester into data
! structure:
ORDER^REQUEST.NAME.LAST ':=' SBUFFER[0] FOR
$LEN(ORDER^REQUEST);
! Position pointers to appropriate record, based on
! the key value supplied in the request:
POSITIONING^MODE := EXACT;
CALL KEYPOSITION(INV^FNUM,ORDER^REQUEST.PART^NUMBER,
!key^specifier!,
!length^word!,
POSITIONING^MODE);
IF <> THEN CALL FILE^ERRORS(INV^FNUM);
! Read the record from the inventory file:
CALL READUPDATELOCKX(INV^FNUM,SBUFFER,BUFSIZE,
COUNT^READ);
! If unable to position to the requested key, return
! the error number. This error occurs when the key is
! not in the orders file.
IF <> THEN
BEGIN
CALL FILE_GETINFO_(INV^FNUM,REPLY^ERROR);
REPLY^LEN := 0;
RETURN;
END;
! Copy the contents of the buffer into the part record
! structure:
PART^REC.PART^NUMBER ':=' SBUFFER FOR $LEN(PART^REC);