/sys$common/syshlp/helplib.hlb FORTRAN, Statements, OPEN, KEY *Conan The Librarian (sorry for the slow response - running on an old VAX) |
KEY = (kspec[,kspec]...) kspec Takes the following form: e1:e2[:dt[:dr]] e1 Is the position of the first byte of the key in the record. e2 Is the position of the last byte of the key in the record. dt Is the data type of the key: CHARACTER (*DEFAULT*) or INTEGER. dr Is the direction of the key: ASCENDING (*DEFAULT*) or DESCENDING. The length of the key must not exceed 255 bytes. The first byte position of the key must be at least 1 and the last byte position must not exceed the length of the record. If the key type is INTEGER, the key length must be either 2 or 4. Defining Primary and Alternate Keys: You must define at least one key in an indexed file. This primary key is the default key. It usually has a unique value for each record (no duplicates). Alternate keys can be duplicated. You can choose to define alternate keys. RMS allows up to 254 alternate keys. However, individual OPEN statements only allow up to 85 key definitions, a number that is further reduced when multiple OPEN statements appear together in a program unit. If a file requires more keys than the OPEN statement limit, you must create it from another language or with the File Definition Language (FDL). Specifying and Referencing Keys: You must specify the KEY parameter when creating an indexed file. However, you do not have to respecify it when opening an existing file because key attributes are permanent aspects of the file. These attributes include key definitions and reference numbers for later I/O operations. If you do choose to specify the KEY parameter for an existing file, your specification must be identical to the established key attributes. Following I/O operations use a reference number, called the key-of-reference number, to identify a particular key. You do not specify this number; it is determined by the key's position in the specification list: the primary key is key-of-reference number 0; the first alternate key is key-of-reference number 1, and so forth.
|