home *** CD-ROM | disk | FTP | other *** search
/ Software Du Jour / SoftwareDuJour.iso / BUSINESS / DBASE / DBAPG.ARC / NDX-SIZE.PRG < prev    next >
Encoding:
Text File  |  1985-01-09  |  1.4 KB  |  46 lines

  1. * Program..: NDX-SIZE.PRG
  2. * Author...: Tom Rettig & Luis A. Castro
  3. * Date.....: 8/7/83, 1/17/84, 6/24/84, 9/9/84
  4. * Notice...: Copyright 1983 & 1984, Ashton-Tate, All rights reserved
  5. * Version..: dBASE III, version 1.00; and dBASE II, versions 2.3x & 2.4x.
  6. * Notes....: Calculates the approximate size of index files for 
  7. *            the version of dBASE in which it is running.
  8. *
  9. *            Newly created index files will usually be close 
  10. *            to the largest size calculated by this algorithm.
  11. *            
  12. SET TALK OFF
  13. ?
  14. ?
  15. DO WHILE 1 = 1
  16.    ACCEPT "Enter total width of <key expression> --> " TO string
  17.    STORE VAL(string) TO width
  18.    DO CASE
  19.       CASE width < 1
  20.          SET TALK ON
  21.          RETURN
  22.       CASE width > 100
  23.          ? "Total width cannot exceed 100 characters -- try again."
  24.          LOOP
  25.    ENDCASE
  26.    ACCEPT "Enter total number of records in file --> " TO string
  27.    STORE VAL(string) TO records
  28.    *
  29.    * ---Branch for version of dBASE, and calculate the minimum size.
  30.    IF TYPE('0') = 'C'
  31.       * ---dBASE II.
  32.       STORE INT( records / INT( 509/(width+4) ) +1 ) * 512 TO indexsize
  33.    ELSE
  34.       * ---dBASE III.
  35.       STORE INT( records / INT( 509/(width+8) ) +1 ) * 512 TO indexsize
  36.    ENDIF
  37.    *
  38.    * ---Print the results.
  39.    ? "Smallest approximate size will be:", indexsize*1, "BYTES."
  40.    ? " Largest approximate size will be:", indexsize*2, "BYTES."
  41.    ?
  42. ENDDO
  43. * EOF: Ndx-size.prg
  44.  
  45.  
  46.