Functions and Directives

Function Header() Foundation

Determines the length of the file header of an opened DBF file.

Syntax
Header() --> nBytes
Return

The return value of Header() is an integer numeric value indicating the length of the file header (in number of bytes) of an open DBF file in a work area. When no DBF file is open in the specified work area, the value zero is returned.

Description

The file function Header() returns the number of bytes in the file header of a DBF file. The DBF file must be open in a work area. When the function is called without an alias operator, it returns the length of the file header of the DBF file in the current work area. The function is used with LastRec() and RecSize() to determine the size of an open DBF file. The total file size may be needed for backup routines creating copies of DBF files.

The function Header() returns 0 for all workareas of the PostgreSQL DatabaseEngine, the ODBC DatabaseEngine and for workareas resulting from a Universal SQL SELECT command.

Examples
Header()
// In the example, a UDF is illustrated which determines the 
// size of a DBF file. 

PROCEDURE Main 
   USE Customer NEW 

   ? Header()                  // result: 224 
   ? RecSize()                 // result: 184 
   ? LastRec()                 // result: 100 

   ? DbfFileSize()             // result: 18625 

   USE 
RETURN 

FUNCTION DbfFileSize() 
RETURN ( (RecSize() * LastRec()) + Header() + 1 ) 

Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.