RecSize(), LUpdate(), RecCount()
These three functions return status information on a specified table based on information stored in the table's header. If your tables start giving you wacky results, and you're an intrepid enough hacker to hex-edit the header to fix them (make a backup first!), here are some clues as to how they are stored. All three functions return an empty value—0 for the numeric functions, and an empty date for LUPDATE()—if no table is available, but complain if passed a bogus alias. When passed a null value, all three functions return error 17, "Invalid table number."
Usage |
nRetVal = RECSIZE( [ cAlias | nWorkArea ] ) |
Parameter |
Value |
Meaning |
cAlias |
Character |
The alias of the table whose record size is returned. |
Omitted |
If nWorkArea is also omitted, use current work area. |
|
nWorkArea |
Numeric |
The work area containing the table whose record size is returned. |
Omitted |
If cAlias is also omitted, use current work area. |
Example |
CREATE TABLE sample (dDate D, ; cTime C(6), ; yCurrency Y, ; nNumeric N(9,3), ; mMemo M) ? RECSIZE() && 36 COPY TO sample2 TYPE FOX2X USE sample2 ? RECSIZE() && It took 54 characters to store in Fox 2.x! |
Usage |
dRetVal = LUPDATE( [ cAlias | nWorkArea ] ) |
For Visual FoxPro 5 and earlier, only the last two digits of the year are stored within the DBF header—updating a file in 1900 or in 2000 both store CHR(00) to byte 1. While the former is unlikely, you should consider several coding alternatives. If you're planning on having your code span centuries, you may need to test LUPDATE()'s return and add 100 to it if the current date is greater than 12/31/1999. Or write a roll-your-own type of ROLLOVER process. Or you could avoid this function altogether: Consider the FDATE() function instead. |
Example |
? LUPDATE("Customer") && Displays date last updated |
Usage |
nRetVal = RECCOUNT( [ cAlias | nWorkArea ] ) |
Example |
? RECCOUNT("Labels") && 86 on our copies - yours may vary |
See Also |
ADir(), AFields(), Display, FCount(), FDate(), FSize(), List |