home *** CD-ROM | disk | FTP | other *** search
/ World of Shareware - Software Farm 2 / wosw_2.zip / wosw_2 / DATABASE / ZIPCODES.ZIP / DEMO.PRG < prev    next >
Text File  |  1993-09-07  |  2KB  |  102 lines

  1. *  This is generic dBase III Code and will run within dBAse III and dBase IV
  2. *  To compile for Clipper:
  3. *       Clipper demo.prg
  4. *       RTLINK FI demo
  5.  
  6. SET CONFIRM ON
  7. SET COLOR TO W/B
  8. SET TALK OFF
  9. SET SCOREBOARD OFF
  10. SET BELL OFF
  11. CLEAR
  12. SET STATUS OFF
  13. USE zipcodes
  14. * Check for existance of ndx file. If it is not present, query ì
  15. * for creation of file
  16.  
  17. IF .NOT. FILE("ZIPCODES.NDX") .AND. .NOT. FILE("ZIPCODES.NTX")
  18.     CLEAR
  19.     answer = "Y"
  20.     @ 1,1 SAY "You need an index file, requiring approximately 800K"
  21.     @ 2,1 SAY "of space:"
  22.     @ 2,10 SAY "   Continue?" GET answer
  23.     READ
  24.     IF UPPER(answer) = "Y"
  25.         SET TALK ON
  26.         CLEAR
  27.         @ 12,36 SAY "Indexing"
  28.         INDEX ON zipcode TO zipcodes
  29.         SET TALK OFF
  30.         CLEAR
  31.     ELSE
  32.         CANCEL
  33.     ENDIF
  34. ELSE
  35.     SET INDEX TO zipcodes
  36. ENDIF
  37.  
  38. * Open address database
  39. SELECT 2
  40. USE demo
  41. * Now enter data
  42. APPEND BLANK
  43. DO WHILE .T.
  44.     SELE 2
  45.     @  3, 29  SAY "Help Software Demo"
  46.     @  6,  9  SAY "First Name:"
  47.     @  6, 26  GET  demo->fname
  48.     @  8,  9  SAY "Last Name:"
  49.     @  8, 26  GET  demo->lname
  50.     @ 10,  9  SAY "Address:"
  51.     @ 10, 26  GET  demo->address
  52.     @ 12,  9  SAY "City:"
  53.     @ 12, 26  SAY  demo->city
  54.     @ 14,  9  SAY "State:"
  55.     @ 14, 26  SAY  demo->state
  56.     @ 14, 32  SAY "Zip Code:"
  57.     @ 14, 43  GET  demo->zipcode
  58.     @ 16,  9  SAY "Phone:"
  59.     @ 16,  16 SAY  demo->phone PICTURE "(   )    -    "
  60.     @  2,  8  TO 18, 69
  61.     @  4,  9  TO  4, 68
  62.     @ 19,27     SAY "Press ESC to Abort Program"
  63.     READ
  64.  
  65.     * Check for ESC key
  66.     IF READKEY() = 12
  67.         EXIT
  68.     ENDIF
  69.  
  70.     huntzip=zipcode
  71.     SELECT 1
  72.  
  73.     * If no Zipcode, then loop back through the record
  74.     IF demo->zipcode = SPACE(5)
  75.         LOOP
  76.     ENDIF
  77.  
  78.     FIND &huntzip
  79.     IF FOUND()
  80.         SELECT 2
  81.         *move data into database
  82.         REPLACE zipcode WITH A->zipcode,;
  83.             state WITH A->state,;
  84.             city WITH A->city
  85.  
  86.         @ 12,  9  SAY "City:"
  87.         @ 12, 26  SAY  demo->city
  88.         @ 14,  9  SAY "State:"
  89.         @ 14, 26  SAY  demo->state
  90.         @ 16,  16 GET  demo->phone PICTURE "(999) 999-9999"
  91.         READ
  92.     ELSE
  93.         @ 22,0
  94.         WAIT "That zip code is not on file...any key to continue"
  95.     ENDIF
  96.     @ 23,0 CLEAR TO 23,79
  97.     APPEND BLANK
  98. ENDDO
  99. CLOSE ALL
  100.  
  101.  
  102.