Determine the record length of a database file.
XSharp.RT (in XSharp.RT.dll) Version: 2.08
Syntax View Source
FUNCTION RecSize() AS LONG
public static int RecSize()
The record length, in bytes. RecSize() returns 0 if no database file is open.
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).
The following function, DBFSize(), uses RecSize() to calculate the size of the current database file:
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