bdfp1m0n | Programming Concepts and Reference |
Specifying keys includes information such as the displacement and length of
the key fields, a comparison operator, and the values to compare the fields
against. By using keys, you can identify an LREC or group of LRECs in a
subfile that match certain criteria. Keys become active when you:
- Specify KEYn parameters on a macro.
- Use a key list with the DBKEY macro or dfkey function, or with
the KEYLIST parameter on a macro.
- Use default keys with the DBADD macro or dfadd function.
Active keys remain in effect and are used by the TPFDF product while the
file is open until one of the following conditions occurs.
- If you specify different keys using one of the previously mentioned
methods, the new keys will be used and remain in active.
- If you use the NOKEY, FAST, or INLINE parameter with another macro that
accesses the subfile, any currently active keys are deactivated.
- If you use the DFxxx_NOKEY, DFxxx_FAST, or
DFxxx_INLINE value of the options parameter for another
function that accesses the subfile, any currently active keys are deactivated
(xxx represents the function; for example,
DFADD_NOKEY).
- If you code a DBADD macro or dfadd function and the database
definition (DBDEF) has default keys specified, the default keys become the
active keys.
- If you specify a DBREP macro or dfrep function and KEYCHECK=YES
is defined on the DBDEF macro, the active keys cannot be predicted.
Key lists and the KEYn parameters provide the same function, but
the following operations are only available with key lists:
- Default keys on read operations, or any macro or function that implies a
read operation (for example, the DBDEL macro and dfdel function
read the record before deleting it).
- Boolean OR logic with keys.
- Global modification of LRECs.
In addition, the following are other differences between key lists and
KEYn parameters:
- You can specify as many as 180 keys with a key list, but you can specify
only as many as 6 keys with the KEYn parameters.
- Key lists generate the active keys at run time, but the KEYn
parameters generate the active keys at assembly time.
See the individual macro descriptions for details about the format of the
KEYn parameters. See Setting Up and Using a Key List for more information about using key lists.