I am looking for a way how to read DataFlex 6.2 data files from a .NET C# program. I need a sequential read only access to the table data with no special functions, basically just decode few .dat files containing data and make a DataTable from it.
I know there are commercial product like FlexODBC, but it seems to me overkill for such a relatively simple task. Perhaps somebody knows of a free alternative or the data files structure documentation, so that I do not need to figure it myself with a hex editor?
I have recently found this link. Checked it with couple of tables and it is not 100% ok, but it is a very good quidance:
In the file I am decoding (table version 3.0.) there is no record length, field lists starts at offset
2E0and gaps between records seem to be filled with20instead of00. Also the records are not aligned to 512 but record size grows by 128. Zero record starts atC00. Aligned records size can be calculated like(FileSize - C00)/RecordCount. But the correct way is to read it from0x9Aposition asuint. InA5there is a field count.As for data types:
Dates are stored in embedded database using 3 bytes, in BCD format. It is a BCD number representing a number of days since min date.
700000represents1642-09-17, so this number can serve me as a base.Numbers: a number 510000001 is stored like
15 10 00 00 01, which is readable in hex editor quite well.So here is a code snippet to parse DAT file into DataTable C#:
Usage is like this: