Determine the record length of a database (.dbf) file

     RECSIZE() --> nBytes


     RECSIZE() returns, as a numeric value, the record length in bytes of the
     database file open in the current work area.  RECSIZE() returns zero if
     no database file is open.


     RECSIZE() is a database function that determines the length of a record
     by summing the lengths of each field then adding one for the DELETED()
     status flag.  When this value is multiplied by LASTREC(), the product is
     the amount of space occupied by the file's records.

     RECSIZE() is useful in programs that perform automatic file backup.
     When used in conjunction with DISKSPACE(), the RECSIZE() function can
     assist in ensuring that sufficient free space exists on the disk before
     a file is stored.

     By default, RECSIZE() operates on the currently selected work area.  It
     will operate on an unselected work area if you specify it as part of an
     aliased expression (see example below).


     .  The following user-defined function, DbfSize(), uses RECSIZE()
        to calculate the size of the current database file:

        FUNCTION DbfSize
           RETURN ((RECSIZE() * LASTREC()) + HEADER() + 1)

     .  This example illustrates the use of RECSIZE() to determine the
        record length of database files open in unselected work areas:

        USE Customer NEW
        USE Sales NEW
        ? RECSIZE(), Customer->(RECSIZE())
        ? DbfSize(), Customer->(DbfSize())

 Files   Library is EXTEND.LIB.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.