home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / database / trl14db.zip / TRLPRG.EXE / NTXSIZE.PRG < prev    next >
Text File  |  1990-10-22  |  854b  |  30 lines

  1. *********
  2. *  NTXSIZE.PRG
  3. *
  4. *  by Tom Rettig and Leonard Zerman
  5. *
  6. *  Placed in the Public Domain by Tom Rettig Associates, 10/22/1990.
  7. *
  8. *  Syntax: NTXSIZE( <key length>, <expN> )
  9. *  Return: <expN> integer maximum potential number of bytes in index file
  10. *********
  11.  
  12. PARAMETERS keylen, last_recno
  13. IF last_recno = 0
  14.    tr_retn =  2048      && size of empty ntx file, any key size
  15. ELSE
  16.    tr_retn = INT((last_recno/INT(((1020/(keylen + 10))-1)/2))+1) * 1024
  17. ENDIF
  18. IF fox
  19.    RETURN (tr_retn)
  20. ENDIF
  21.  
  22. * return statement is based on this algorithm:
  23. * maxitem = 1020 / (keylen+10)              && max items per node
  24. * minkeys = int( (maxitem-1) / 2 )          && min keys per node
  25. * knodes  = int( last_recno / minkeys )     && kbytes of nodes
  26. * return (knodes+1) * 1024                  && add one for the header
  27.  
  28. * eofunc ntxsize *
  29.  
  30.