When TDbf.CopyFrom is called with parameter Level = 4 (to generate a dBase IV table) the routine creates a dBase IV table on my own computer (with Dutch regional settings) but a Visual dBase table on a computer with Czech as Regional settings.
I localized the problem in the TDbfFile.FinishCreate routine which generates a FFileLangId if this is zero and uses this to set the Language byte in the Header. With Czech regional settings FFileLangId = 200 and this is an invalid value for a dBase IV table. Because of this the table is treated as a Visual dBase table and a .CDX index is generated when an index is added instead of a .MDX index)
At least in the TDBF version that FreePascal uses, the Czech language code used was incorrect.
See here for the required changes:
http://svn.freepascal.org/cgi-bin/viewvc.cgi/trunk/packages/fcl-db/src/dbase/dbf_lang.pas?r1=25125&r2=25124&pathrev=25125
and the attached patch
Last edit: Reinier Olislagers 2014-06-22