Guardian Programmer's Guide

Table Of Contents
Communicating With Processes
Guardian Programmer’s Guide 421922-014
6 - 44
Programming the Requester
! Prompt the user to read the next record (user
! must respond "y" to accept, otherwise return
! to select next function):
SBUFFER ':=' ["Do you want to read another ",
"record (y/n)? "]
-> @S^PTR;
CALL WRITEREADX(TERMNUM,SBUFFER,@S^PTR '-' @SBUFFER,
BUFSIZE,COUNT^READ);
IF <> THEN CALL FILE^ERRORS(TERMNUM);
SBUFFER[COUNT^READ] := 0;
END
UNTIL NOT (SBUFFER[0] = "y" OR SBUFFER[0] = "Y");
END;
!------------------------------------------------------------
! Procedure for updating a record. The user selected
! function "u." The user is prompted to enter the part
! number of the record to be updated, then the old contents
! are displayed on the user's terminal before the user is
! prompted to enter the updated record.
!------------------------------------------------------------
PROC UPDATE^RECORD;
BEGIN
INT COUNT^READ;
INT ERROR;
STRUCT .SAVE^REC(PART^RECORD);
STRUCT .CHECK^REC(PART^RECORD);
PRINT^BLANK;
! Prompt the user for the part number of the record to be
! updated:
PRINT^BLANK;
SBUFFER ':=' "Enter Part Number: " -> @S^PTR;
CALL WRITEREADX(TERMNUM,SBUFFER,@S^PTR '-' @SBUFFER,
BUFSIZE,COUNT^READ);
IF <> THEN CALL FILE^ERRORS(TERMNUM);
! Fill in the request to read the part record:
REQUEST.PART.PART^NUMBER ':=' [PARTSIZE*[" "]];
REQUEST.PART.PART^NUMBER ':=' SBUFFER FOR COUNT^READ;
REQUEST.REQUEST^FUNCTION := READ^EXACT;