space
Previous Page | Next Page

ACCESS Procedure Reference

KEY Statement



Specifies a BY key for an elementary data field that is designated as an ADABAS descriptor.
Optional statement
Applies to: access descriptor or view descriptor
Interacts with: ASSIGN
Default: blank

Syntax
Details

Syntax

KEY<=> column-identifier-1 <...column-identifier-n>;


Details

The KEY statement specifies a BY key for an elementary data field. This field must be an ADABAS descriptor.

A BY key, which is an optional set of match variables, is used only when the interface view engine must examine additional ADABAS records in order to add a new periodic group occurrence. The engine uses the BY key variables in temporary WHERE clauses that are designed to locate a record for modification. Examining the additional ADABAS records is required only if data is changed above the periodic group level from one observation to the next in a view descriptor with a selected periodic group. It is suggested that you use BY key variables even if they are not always needed.

A data field is a good candidate for a BY key variable if it uniquely identifies a logical record. The incoming values of the data fields in a BY key variable are matched to existing values in order to locate a position in which to insert new periodic groups. (A BY key variable is similar to a BY group or a BY variable in SAS.)

The KEY statement can have the following values:

blank

(default) indicates that the data field is not to be used as a KEY.

N

specifies that the data field is not to be used as a KEY.

Y

specifies that the data field is to be used as a KEY.

An editing statement, such as KEY, must follow the CREATE statement and the database-description statements when you create a descriptor. See CREATE Statement for more information about the order of statements.

You can use the KEY statement with a view descriptor only if the ASSIGN statement that was used when creating the access descriptor was specified with the NO value.

You do not have to issue a SELECT statement in a view descriptor for the columns included in the KEY statement. The KEY statement selects the columns. When you use the KEY statement with an access descriptor, the KEY statement reselects columns that were previously dropped with the DROP statement.

space
Previous Page | Next Page | Top of Page