RecSize Function (Usual) | |
Determine the record length of a database file.
Namespace:
XSharp.RT
Assembly:
XSharp.RT (in XSharp.RT.dll) Version: 2.19
Syntax FUNCTION RecSize(
uArea AS USUAL
) AS LONG
public static int RecSize(
Usual uArea
)
Request Example
View SourceParameters
- uArea
- Type: Usual
Specifies the work area name or number for a table from which the value must be retrieved.
Return Value
Type:
Long
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, 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 overload that accepts a workarea
parameter (a workarea number or alias ).
Examples
The following function, DBFSize(), uses RecSize() to calculate the size of the current database file:
1FUNCTION DBFSize
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
3QOut(RecSize(), Customer->RecSize())
4QOut(DBFSize(), Customer->DBFSize())
See Also