home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / database / dba0187.zip / STATEVAL.PRG < prev    next >
Text File  |  1986-12-05  |  1KB  |  41 lines

  1. * STATEVAL.PRG
  2. *
  3. * written by: Bob Green    date    : 04/26/86
  4. *                          modified: 08/24/86
  5. * Copyright 1986, Data Based Solutions, Inc.
  6. * All Rights Reserved
  7. *
  8. * this is a GETFILE program to validate the field entered is a
  9. * valid U.S.P.S. two-letter state abbreviation.
  10. *
  11. * the calling program must use a statement as follows:
  12. *
  13. * @ xx,yy SAY "desired input text" GET variable PICTURE "!!" ;
  14. *             GETFILE stateval.prg
  15. *
  16. * this routine works with dBMAN V2.0 or later
  17.  
  18. * set up a getfile-routine field containing the name of
  19. * the `get' field that was `read' by the calling program
  20. STORE GETNAME() TO y.getfld
  21.  
  22. * set up a variable containing the valid state abbrev's
  23. STORE "AL|AK|AZ|AR|CA|CO|CT|DE|DC|FL|GA|HI|ID|IL|IN|IA|"+;
  24. "KS|KY|LA|ME|MD|MA|MI|MN|MS|MO|MT|NE|NV|NH|NJ|NY|"+;
  25. "NC|ND|OH|OK|OR|PA|PR|RI|SC|SD|TN|TX|UT|VT|VA|WA|"+;
  26. "WV|WI|WY" TO y.valid_st
  27.  
  28. * use a macro substitution for the field name when determining
  29. * if the field READ was valid
  30. IF INSET("|",&y.getfld,y.valid_st) = 0
  31.  
  32.   * the field entered is not valid, write an error message on the
  33.   * screen, and perform your standard validation error routine
  34.   STORE "'"+&y.getfld+"' IS NOT A VALID STATE" TO m_errmsg
  35.   DO errmsg.prg
  36.  
  37.   * force the same field to be READ again
  38.   ASSIGN USERSTAT(0)
  39. ENDIF
  40. RETURN
  41.