Guardian Programmer's Guide

Table Of Contents
Writing a Requester Program
Guardian Programmer’s Guide 421922-014
21 - 41
Coding the Requester Program
! Check whether order number all numeric. Request
! another order number if not:
I := 0;
WHILE I < 28 DO
BEGIN
IF SBUFFER[I] < "0" OR SBUFFER[I] > "9" THEN
BEGIN
! Print diagnostic for failed test:
PRINT^BLANK;
PRINT^STR("Order Number Must Be Numeric");
PRINT^STR("Please Type Another Order Number");
PRINT^BLANK;
GOTO REPEAT;
END;
I := I + 1;
END;
!------------------------------
! Get the order record from
! the server.
!------------------------------
! Send order number to server:
CALL WRITEREADX(SERV3^NUM,SBUFFER,$LEN(ORDER^QUERY),
BUFSIZE);
IF <> THEN
BEGIN
CALL FILE_GETINFO_(SERV3^NUM,ERROR);
CASE ERROR OF
BEGIN
! If server could not find a record with supplied
! key (order number), print message and request
! another order number:
11 -> BEGIN
! Print diagnostic:
PRINT^BLANK;
PRINT^STR("No Such Order Number");
PRINT^STR("Please Type Another Order Number");
PRINT^BLANK;
END;
! Other error, call FILE^ERRORS to display error
! and exit the process:
OTHERWISE -> CALL FILE^ERRORS(SERV3^NUM);
END;
END;