home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a013 / 1.ddi / SAMPLES.EXE / T_MAKEND.PRG < prev    next >
Encoding:
Text File  |  1991-01-25  |  1.8 KB  |  70 lines

  1. *****************************************************************
  2. * Test program for MAKENDX, DBNAMES, PICKIT     FILE T_MAKEND.PRG
  3. *****************************************************************
  4.  
  5. * Copyright(c) 1991 -- James Occhiogrosso
  6.  
  7. # include "inkey.ch"
  8.  
  9. LOCAL db_error := '', choices := keypress := 0, index_ok := .F.,;
  10.       text_array := {}, dbf_array := {}
  11.  
  12. INITGLOBAL()
  13. SETCOLOR(colstd)
  14.  
  15. DO WHILE keypress != K_ESC
  16.  
  17.     CLEAR
  18.     * Clear and load arrays with database names/descriptions
  19.     text_array := {} ; dbf_array := {}
  20.  
  21.     * Get database names for indexing
  22.     db_error = DBNAMES('arsystem.def', text_array, dbf_array)
  23.  
  24.     IF EMPTY(db_error)
  25.  
  26.        * Use PICKIT to display the text array and fill
  27.        * return array with operator selections
  28.  
  29.        CENTERON(24, 'Use up/dn arrow keys to move highlight.';
  30.                   + ' Press return to select, Esc when done.')
  31.  
  32.        choices = PICKIT(5, 12, 15, 64, text_array, dbf_array)
  33.        @ 24, 0
  34.        index_ok = .F.
  35.        IF choices > 0
  36.  
  37.            * Call MAKENDX with array of selected database names
  38.            * and name of application data dictionary to
  39.            * recreate indexes for selected databases
  40.  
  41.            index_ok = MAKENDX(dbf_array, "arsystem.def")
  42.  
  43.        ENDIF
  44.  
  45.        IF index_ok
  46.            @ 24, 10 SAY 'Indexing complete. '
  47.        ELSE
  48.            @ 24, 10 SAY IF(choices = 0, 'No selections made ', ;
  49.                                         'Indexing error. ')
  50.        ENDIF
  51.  
  52.     ELSEIF db_error = 'D'
  53.        @ 24, 10 SAY 'Data dictionary file missing.'
  54.  
  55.     ELSEIF db_error = 'P'
  56.        @ 24, 10 SAY 'Incorrect Parameter passed. '
  57.  
  58.     ELSE
  59.        @ 24, 10 SAY 'Error with file ' + db_error
  60.     ENDIF
  61.  
  62.     ?? ' Press any key to loop, or Esc to quit '
  63.     keypress = INKEY(0)
  64.     @ 24, 0
  65.  
  66. ENDDO
  67.  
  68. RETURN
  69.  
  70.