Determine the record length of a database file.
XSharp.RT (in XSharp.RT.dll) Version: 2.4a
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, this function operates on the currently selected work area.
It can be made to operate on an unselected work area by specifying it within an aliased expression or by calling the that accepts a workarea parameter (a workarea number or alias ).
The following function, DBFSize(), uses RecSize() to calculate the size of the current database file:
2 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:
1USE customer NEW
2USE sales NEW