Guardian Programmer's Guide

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