MEMORY Files with Alternate Keys

Memory files (*memory*) can now have alternate keys specified. When opening a memory file you can add a KEYDEF= option that defines the alternate key definition. Standard ProvideX alternate key definitions can be used as follows:

Code Description
"A" Ascending key (assumed).
"D" Descending order (default is ascending).
"U" If you declare an alternate key segment as unique, then no duplicate keys are allowed on writing a record. System will generate an Error #11: Record not found or Duplicate key on write if the key being added already exists on the file. If any segment in a key definition is marked as unique, then the entire key is considered unique.
"C" Force uppercase for individual key segments to create upper-case insensitive keys
"L" Force lowercase for individual key segments to create lower-case insensitive keys.
"T" Force automatic accent translation for individual key segments (i.e., to translate accented/extended characters to their non-accented counterparts) useful when sorting multilingual characters into a single unified sort sequence.
"K[:n]" Null key suppression. n is the hex value of the character to suppress if all characters match (defaults to $00$ if not specified). If the entire key evaluates to null, the key will not be a part of this key tree. This cannot be used on a primary key. Unlike standard keyed files this can be used in conjunction with the "N" option.
"N[:n]" Null segment suppression. n is the hex value of the character to suppress if all characters match. If any segment within the key evaluates to null, the key will not be a part of this key tree. Unlike standard keyed files this can be used in conjunction with the "N" option.

For Example:

OPEN (1) "*memory*;KEYDEF=6,[2:1:6:""U""],[3:1:30]"

Keynames can also be specified, if desired.

NOTE: Unlike standard *MEMORY* files, *MEMORY* files created with key definitions cannot have record inserted by record index. The key fields are always used.