bdfp1m1c | Programming Concepts and Reference |
Use this function to activate a key list that is used by subsequent
functions that access the specified file. See Specifying Logical Records (LRECs) Using Keys for more information about keys.
Format
void dfkey(dft_fil *file,
dft_kyl *key_list)
void dfkey_nbr(dft_fil *file,
dft_kyl *key_list, short int n)
- file
- is a pointer to the base address of the SW00SR slot (defined in
c$sw00sr.h) of the subfile that you want to access
and is returned by the dfopn function.
- key_list
- is a pointer to the key list (SW01SR).
- n
- is the number of keys (1-180) that you have set up in the key
list.
Entry Requirements
None.
Normal Return
None.
Error Return
See Identifying Return Indicators and Errors for information about how to check the error
indicators.
Programming Considerations
- The type definitions (for example, dft_fil,
dft_ref, and dft_kyl) are defined in the
c$cdfapi.h header file.
- To avoid the possibility of corrupting the organization of a subfile, do
not use keys (set up with a dfkey function) when adding LRECs to a
file. Instead, have the database administrator set up keys in the
database definition (DBDEF) that defines the file. These are called
default keys and override any keys you set up with the
dfkey function. See TPFDF Database
Administration for more information about defining default keys.
- You can define any number of key list structures in your program.
Each key list can have from 1-180 keys. See Specifying Logical Records (LRECs) Using Keys for more information about key lists.
Examples
See Setting up a Key List with Less than Six Keys and Setting up a Key List in the Range 1-180 for examples of how to set up a key
list.
Related Functions