home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / CLIPPER / MISC / DLNTX.ZIP / INDEXSZ.PRG
Encoding:
Text File  |  1988-08-08  |  1.4 KB  |  96 lines

  1.  
  2. Parameters DbfName,Ntx1,Ntx2,Ntx3,Ntx4,Ntx5,Ntx6,Ntx7,Ntx8,Ntx9,Ntx10
  3.  
  4. If Type('Ntx1') = 'U'
  5.    Ntx1 = DbfName
  6. EndIf
  7.  
  8. If Type('DBFName') = 'U'
  9.    Quit
  10. EndIf
  11.  
  12. If ! '.' $ DBFName
  13.    DBFName = DBFName + '.DBF'
  14. EndIf
  15.  
  16. Use &DbfName.
  17. Clear
  18.  
  19. ? 'Analyzing &DbfName.'
  20.  
  21. ? 'Record Count  = '
  22. ?? Ltrim(Str(RecCount()))
  23.  
  24.  
  25. From = Row()
  26.  
  27. *****************************
  28. * Repeat for all open indices:
  29.  
  30. For X = 1 To PCount() - 1
  31.  
  32. @ From + 3, 0 Clear To 24, 79
  33. @ From + 3, 0
  34.  
  35. Ntx = Str(X,1)
  36. Ntx = 'Ntx' + Ntx
  37. Ntx = &Ntx.
  38.  
  39. If ! '.' $ Ntx
  40.    Ntx = Ntx + '.NTX'
  41. EndIf
  42.  
  43. Set Index To &Ntx.
  44. ? 'Current index  = &Ntx.'
  45. ?
  46.  
  47.  
  48. Jazz = IndexKey(0)
  49.  
  50. Jazz = If(Empty(Jazz),.T.,&Jazz.)
  51.  
  52. ? 'Index Key     = ' + If(Type('Jazz') $ 'NCD' , IndexKey(0) , 'ERROR')
  53.  
  54. ? 'Length of Key = '
  55.  
  56. Do Case
  57.  
  58.    Case Type('Jazz') = 'N'
  59.         KeyLen = Len(Str(Jazz))
  60.  
  61.    Case Type('Jazz') = 'C'
  62.         KeyLen = Len(Jazz)
  63.  
  64.    Case Type('Jazz') = 'D'
  65.         KeyLen = 8
  66.  
  67.    Otherwise
  68.         ?? 'Error in index key ' + Ltrim(Str(X))
  69.         Wait
  70.         Quit
  71.  
  72. EndCase
  73.  
  74. ?? Ltrim(Str(KeyLen))
  75.  
  76. ? 'Size of index = '
  77. ?? Ltrim(Str(NtxSize(RecCount(),KeyLen))) + '  (Our Function)'
  78.  
  79. ?
  80. ? 'DOS reports:'
  81. dir &Ntx.
  82. wait
  83.  
  84. Next
  85. ********************************
  86.  
  87.  
  88. quit
  89.  
  90.  
  91. *----------------------------------------
  92. Function NtxSize
  93. Parameters Ntx_Recs,Ntx_KyLen
  94. Return Max(Int(((Ntx_Recs / Int(((1020/(Ntx_KyLen+10))-1)/2))+1) * 1024),Int(2048))
  95.  
  96.