Guardian Programmer's Guide

Table Of Contents
Writing a Requester Program
Guardian Programmer’s Guide 421922-014
21 - 36
Coding the Requester Program
!----------------------------
! Prompt for and process the
! customer's zip code
!----------------------------
! Repeat until valid zip code entered:
REPEAT^ZIP:
! Prompt user for zip code:
PRINT^BLANK;
START^LINE;
PUT^STR("Enter Zip Code: ");
CALL WRITEREADX(TERM^NUM,SBUFFER,@S^PTR '-' @SBUFFER,
BUFSIZE,COUNT^READ);
! If zip code does not have exactly 7 characters, prompt
! user to issue another zip code:
IF COUNT^READ <> 7 THEN
BEGIN
PRINT^BLANK;
PRINT^STR("Zip Code Must Have Exactly 7 Characters ");
PRINT^STR("Please Enter a Valid Zip Code ");
GOTO REPEAT^ZIP;
END;
! If either of the first two characters of the zip code is
! nonalphabetic, reenter the zip code:
I := 0;
WHILE I < 2 DO
BEGIN
IF SBUFFER[I] < "A" OR SBUFFER[I] > "z" OR
(SBUFFER[I] > "Z" AND SBUFFER[I] < "a") THEN
BEGIN
PRINT^STR("First Two Characters Must Be ” &
"Alphabetic ");
PRINT^STR("Please Enter an Alphabetic Characters ");
GOTO REPEAT^ZIP;
END;
I := I + 1;
END;