Click or drag to resize

RecSize Function

Determine the record length of a database file.

Namespace:  XSharp.RT
Assembly:  XSharp.RT (in XSharp.RT.dll) Version: 2.08
Syntax
 FUNCTION RecSize() AS LONG
View Source

Return Value

Type: Int32
The record length, in bytes.  RecSize() returns 0 if no database file is open.
Remarks
RecSize() 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 all of 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).
Examples
The following function, DBFSize(), uses RecSize() to calculate the size of the current database file:
X#
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:
X#
USE customer NEW
USE sales NEW
QOut(RecSize(), Customer->RecSize())
QOut(DBFSize(), Customer->DBFSize())
See Also