KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Understanding the creation and uses of the "Datafile.match" file
PRODUCT: 4D | VERSION: 12 | PLATFORM: Mac & Win
Published On: February 16, 2012

Almost every file and folder created and saved by 4D is in relation to where the structure file, .4DB or .4DC, is located. This is not always true and in one case it is critical to know if the data file ever becomes corrupted to the point that "Recover by record headers" has to be used on the data file. A critical file used by 4D in the execution of this process is the "datafile.match" file.

The "datafile.match" file is colocated with the data file, <YourDataBase>.4DD, not with the structure file, .4DB or .4DC.

This is important information because the data file is commonly moved outside the folder that contains the structure file. As soon as a database is opened and the datafile to open is chosen, if there is no "datafile.match" file found at the same level as the data file, 4D will create a new "datafile.match" file colocated with the data file.

Since the release of 4D v11.5, the file "datafile.match" is created at the same level that the datafile as soon a datafile will be opened or created. This file is updated whenever a table is added, modified, or delete.

This file, written in XML, contains, in each "DataTable" element the table number, "num" attribute, and the UUID, "TableDefID" attribute, matching with the tables of the Structure file, see example below.

<?xml version="1.0" encoding="utf-8"?>
<DataTableMatching>
  <DataTable num="1" TableDefID="512E2B96989041368DF5BA054E6E26BD" />
  <DataTable num="2" TableDefID="2D8069E581E543679467F544C930AEF2" />
  <DataTable num="3" TableDefID="5C770012905742FEAA46B17F152E4398" />
  <DataTable num="4" TableDefID="117BD38564374338942400B63C96FDEC" />
  <DataTable num="5" TableDefID="F41FA861092D4CEDB75805FB49CC3C0B" />
  <DataTable num="6" TableDefID="70A39944B5E14E43B79DC2606E33B552" />
  <DataTable num="7" TableDefID="B2BAA553D728416F8D9C2E07F63625ED" />
  <DataTable num="8" TableDefID="056C2245E7834D4F9BB07794218B204E" />
  <DataTable num="9" TableDefID="7CF079631C9044008789E40AC3A969B6" />
  <DataTable num="10" TableDefID="453924D7DF7A4D0EBFAEBAB4C67C6247" />
</DataTableMatching>


This information is useful especially if the first blocks of the datafile has been damaged. The first blocks in the datafile contain the table number and UUID that are also used with in the 4D v12 "Recover by record headers." If these blocks are damaged, the "Recover by record headers" will use the "datafile.match" file to match the tables recovered, with the tables of the structure file.

Normally, in 4D v11.6 and newer, 4D v12, and 4D v13 this file will be added with the files to backup automatically, but it is not the case with 4D v11.5. So, to be sure to have a backup of this file, depending on 4D version, you may need to add it manually. 

See Also: