RECSIZE( ) Function Example

In the following example, Microsoft Visual FoxPro compares the available disk space with the amount needed to sort customer.

*** Check DISKSPACE before a SORT ***

CLOSE DATABASES
OPEN DATABASE (HOME(2) + 'Data\testdata')
USE customer  && Opens Customer table

*** Get size of table header ***

gnTableHead = HEADER( )

*** Calculate size of table ***

gnFileSize = gnTableHead + (RECSIZE( ) * RECCOUNT( ) + 1)
IF DISKSPACE( ) > (gnFileSize * 3)
   WAIT WINDOW 'Sufficient diskspace to sort.'
ELSE
   WAIT WINDOW 'Insufficient diskspace. Sort cannot be done.'
ENDIF