Using DOS sorting rules vs. the default Windows sorting rules

This is the #1 solution to fixing issues related to corrupt indexes or corrrupt data.

Apollo supports both DOS and Windows sorting rules

DOS and Windows have different rules for sorting characters, and therefore affect how Apollo creates and maintain indexes. The most common issue that new Apollo users experience is that they unknowingly open a DBF file and index that has been created using DOS sorting rules and the data does not appear to be ordered correctly. This is in fact not the case. What is actually happening is that Apollo must be told to use DOS sorting rules (aka Machine Collation) instead of the default Windows sorting rules in order to manage these types of files. This is also required if your Apollo application needs to run concurrently with a CA-Clipper application that shares the same data files. To use DOS sorting rules, you must tell Apollo to use Machine Collation (i.e. DOS sorting rules).

The "corrupt data" issue becomes apparent when it seems as though data in a DBF is not being updated correctly from either your Apollo application or the CA-Clipper application. The issue is caused becaues Apollo, by default, is using Windows sorting rules to update the indexes, when it should in fact be using DOS-sorting rules. This incorrect setting causes Apollo to corrupt the indexes, which makes data appear out of order, invalid or to simply not appear at all. If you are in this situation, the remedy is to set Apollo to use DOS indexing rules and reindex all indexes.

Instructions

Refer to your Apollo help files and search for "OEMCollation" and "sort order". Basically, you must do the following:

  • Call "SDEEngine.SetMachineCollation" at the start of your Apollo application or before opening any DBF files.

Specific to Delphi/C++Builder users:

  • Add ApoEngInt to your "uses" section since the ApoEngInt unit contains the SDEEngine object
  • Call "SDEEngine.SetMachineCollation" at the start of your Apollo application or before opening any DBF files
  • Set OEMTranslate=True for each table object.
  • Set OptimisticBuffering=False for each table.
    Note: This False setting should be used if the DBF structure/schema has been changed.