HELPLIB.HLB  —  FORTRAN  Statements  OPEN  KEY
  Defines the access keys for records in an indexed file.  It takes
  the following form:

  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 is the
  primary key (the default key).  It usually has a unique value for
  each record.

  You can also define alternate keys.  RMS allows up to 254 alternate
  keys.

  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
  subsequent I/O operations.

  However, if you use the KEY parameter for an existing file, your
  specification must be identical to the established key attributes.

  Subsequent 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.
Close Help