Guardian Programmer's Guide

Table Of Contents
Writing a Requester Program
Guardian Programmer’s Guide 421922-014
21 - 40
Coding the Requester Program
!------------------------------------------------------------
! Procedure to read an order record from the $SER3 process.
! This procedure prompts the user for an order number, which
! it checks for validity before sending it to the $SER3
! server process. The $SER3 process returns the order record
! (if there is one) from the corresponding the order file and
! then this procedure prints the record on the terminal.
!
! This procedure is called from the main procedure when the
! user selects "q" from the main menu.
!------------------------------------------------------------
PROC READ^ORDER;
BEGIN
INT COUNT^READ;
INT ERROR;
INT I;
!-----------------------------
! Prompt for and validate an
! order record number.
!-----------------------------
REPEAT:
! Request an order number from the terminal user:
START^LINE;
PUT^STR("Enter Order Number: ");
CALL WRITEREADX(TERM^NUM,SBUFFER,@S^PTR '-' @SBUFFER,
BUFSIZE,COUNT^READ);
IF <> THEN CALL FILE^ERRORS(TERM^NUM);
! Check that order number contains 28 characters. Request
! another order number if not:
IF COUNT^READ <> 28 THEN
BEGIN
! Print diagnostic for failed test:
PRINT^BLANK;
PRINT^STR ("Order Number Must Have 28 Characters");
PRINT^STR ("Please Type Another Order Number");
PRINT^BLANK;
GOTO REPEAT;
END;