home *** CD-ROM | disk | FTP | other *** search
/ Oakland CPM Archive / oakcpm.iso / sigm / vol110 / search.acg < prev    next >
Encoding:
Text File  |  1984-04-29  |  3.0 KB  |  144 lines

  1. * search.cmd 02/12/83
  2.  
  3. * loop until finished searching
  4. STORE t TO more
  5. DO WHILE more
  6.   
  7.   * set up screen and prompts
  8.   SET FORMAT TO SAY-rec
  9.   STORE 'Search for file by <L>ast name, <C>ompany name or <Z>ipcode' TO prompt1
  10.   STORE '<B>ackward, <F>orward, <D>elete/Recall' TO prompt2
  11.   STORE '<E>dit or <Q>uit searching' TO prompt3
  12.   STORE 'Search Menu' TO mode
  13.   STORE 'L' TO command
  14.   
  15. * DO delcheck.acg
  16.   IF *
  17.      STORE 'Deleted' TO deleted
  18.   ELSE
  19.      STORE ' ' TO deleted
  20.   ENDIF * 
  21.  
  22.   * read the current record and find out what to do
  23.   READ
  24.   * perform selected functions
  25.   DO CASE
  26.       
  27.     CASE (command = 'B' .OR. command = ',' )
  28.       * move backwards one record
  29.       SKIP -1
  30.       
  31.     CASE command = 'D'
  32.       * DO delete.acg
  33.  
  34.       IF *
  35.          RECALL
  36.       ELSE
  37.          DELETE
  38.       ENDIF * 
  39.  
  40.     CASE (command = 'F' .OR. command = '.' )
  41.       * move forward one record
  42.       SKIP
  43.       
  44.     CASE command = 'E' 
  45.       STORE # TO recordno
  46.       SET INDEX TO
  47.       GOTO recordno
  48.       RELEASE recordno
  49.       RECALL 
  50.       DO EDIT.acg
  51.       
  52.     CASE command = 'C' 
  53.       ERASE
  54.       ACCEPT "Please enter Company name" TO name
  55.       * convert name to upper case for searching
  56.       STORE !(name) TO name
  57.       
  58.       * look for matching record
  59.       SET INDEX TO company, lastname, zip 
  60.       FIND &name
  61.       
  62.       * if it isn ' t in the files
  63.       IF # = 0
  64.         
  65.         * clear the screen and say that name can ' t be found
  66.         ERASE
  67.         ?
  68.         ?
  69.         ? name, ' is not in the file' 
  70.         ?
  71.         ? 'Press any key to return to search menu' 
  72.         
  73.         SET console OFF
  74.         WAIT
  75.         SET console ON
  76.         
  77.       ENDIF # = 0 
  78.       
  79.       
  80.       
  81.     CASE command = 'L' 
  82.       ERASE
  83.       ACCEPT "Please enter last name " TO name
  84.       * convert name to upper case for searching
  85.       STORE !(name) TO name
  86.       
  87.       * look for matching record
  88.       SET INDEX TO lastname, company, zip 
  89.       FIND &name
  90.       
  91.       * if it isn ' t in the files
  92.       IF # = 0
  93.         
  94.         * clear screen and say no can find
  95.         ERASE
  96.         ?
  97.         ?
  98.         ?
  99.         ? name, ' is not in the file' 
  100.         ? 'press any key to return to search menu' 
  101.         SET console OFF
  102.         WAIT
  103.         SET console ON
  104.       ENDIF # = 0 
  105.       
  106.       
  107.     CASE command = 'Q' 
  108.       * leave loop
  109.       SET INDEX TO lastname, company, zip
  110.       STORE f TO more
  111.       
  112.     CASE command = 'Z' 
  113.       ERASE
  114.       ACCEPT "Please enter Zipcode for home address " TO name
  115.       * convert name to upper case for searching
  116.       STORE !(name) TO name
  117.       
  118.       * look for matching record
  119.       SET INDEX TO zip, lastname, company 
  120.       FIND &name
  121.       
  122.       * if it isn ' t in the files
  123.       IF # = 0
  124.         
  125.         * clear screen and say no can find
  126.         ERASE
  127.         ?
  128.         ?
  129.         ?
  130.         ? name, ' is not in the file ' 
  131.         ? 
  132.         ? 'press any key to return to search menu ' 
  133.         SET console OFF
  134.         WAIT
  135.         SET console ON
  136.       ENDIF # = 0 
  137.       
  138.   ENDCASE 
  139.   
  140.   RELEASE name
  141.   * loop back again
  142.   
  143. ENDDO WHILE more 
  144.