ODBC4x
External Keys Table Definitions
  External keys are an issue when working with ODBC because the data may be duplicated on the file. This layout can be illustrated as follows:

Data:
CST_ID
 
CST_ID CST_NAME CST_ADDR

 

  When an external key is used in a ProvideX file, the key data can be stored as part of the record data as well. The ODBC driver prefixes the data record with the external key, which can result in key data being duplicated on the record:
CST_ID
CST_ID CST_NAME CST_ADDR

The solution is to hide the data from the ODBC end-user; e.g.,

[*Tables*] Customer=\pvx\nomads\cstfile

[Customer] CST_ID=STRING,LEN=6,FIXED
CST_ID_DUP=STRING,LEN=6,HIDE,SAMEAS=CST_ID CST_NAME=STRING,LEN=30
CST_ADDR=STRING,LEN=30

However, the keyword HIDE is only available when using an INI file to define the data. HIDEis not supported when using the ProvideX Data Dictionary to define file layouts.

   
Keyed Files with External Keys - Direct Files For the purposes of defining fields for a Direct file, the external key is inserted in front of the record as it is read from the file and passed to the ODBC system. For example, if the ProvideX file is created with ORD_NUMBER as the 6-byte external key, and ORD_CUSTOMER and ORD_AMOUNTas data, then the INI record descriptor would be:

[Order]
ORD_NUMBER=STRING,LEN=6,FIXED ORD_CUSTOMER=STRING,LEN=10

ORD_AMOUNT=NUMERIC,LEN=10.2

If the key is duplicated in the data, you should expose the field that is the key and hide the duplicate that is within the data portion. The SQL optimizer will recognize the key field and be able sort the file much faster by using the key chain.