VMS Help PASCAL, Attributes, KEY *Conan The Librarian (sorry for the slow response - running on an old VAX) |
The KEY attribute can be applied to record fields to indicate that the field is to be used as a key field when the record is part of an indexed file. Syntax: KEY [[( n [[, {options},... ]] )]] KEY [[( {options},... )]] The 'n' represents the key number. A key number of 0 indicates that the field is the primary key of the record. All other key numbers indicate alternate keys. The key number must be a constant expression that denotes an integer value in the range from 0 through 254. See the "Compaq Pascal Language Reference Manual" for the complete description of using the KEY attribute.
1 - Options |
You can specify certain characteristics of the record key by listing the desired options on the KEY attribute. With these options, you can control the order of the collating sequence and you can allow changes or duplicates on a key. See the "Compaq Pascal Language Reference Manual" for the complete description of using these options.
1.1 - ASCENDING
This option, along with DESCENDING, allows you to specify the collating sequence for the key field. By default, the primary key and alternate key are ASCENDING. When creating a new file, Pascal will create the key with the collating order specified. When opening an existing file, the Run-Time Library will verify that the existing key matches the collating order specified. If neither ASCENDING or DESCENDING is specified when opening an existing file, both types will be accepted.
1.2 - CHANGES
This option allows you to specify that changes can be performed on the key. The default for the primary key is NOCHANGES and the default for alternate keys is CHANGES. You can override the CHANGES on alternate keys with NOCHANGES. It is illegal to specify CHANGES on the primary key. When opening an existing file, the Pascal Run-Time Library ignores this option.
1.3 - DESCENDING(see ASCENDING)
1.4 - DUPLICATES
This option allows you to specify that duplicates of the key are allowed. The default for the primary key is NODUPLICATES and the default for alternate keys is DUPLICATES. When opening an existing file, the Pascal Run-Time Library ignores this option.
|