RPG/400 Help

KFLD (Define Parts of a Key)

*---------*---------------*-----------------*----------------*---------------*
|   CODE  |    FACTOR 1   |     FACTOR 2    |     RESULT     |  INDICATORS   |
|         |               |                 |      FIELD     |               |
*---------*---------------*-----------------*----------------*---------------*
| KFLD    |               |                 | Key field      |               |
*---------*---------------*-----------------*----------------*---------------*

The KFLD operation is a declarative operation that indicates that a field is part of a search argument identified by a KLIST name.

The KFLD operation can be specified anywhere within calculations, including total calculations. The control level entry (positions 7 and 8) can be blank or can contain an L1 through L9 indicator, an LR indicator, or an L0 entry to group the statement within the appropriate section of the program. Conditioning indicator entries (positions 9 through 17) are not permitted.

The result field must contain the name of a field that is to be part of the search argument. The result field cannot contain an array name or a table name. Each KFLD field must agree in length, data type (character or numeric), and decimal position with the corresponding field in the composite key of the record or file. However, each KFLD field need not have the same name as the corresponding field in the composite key. The order the KFLD fields are specified in the KLIST determines which KFLD is associated with a particular field in the composite key. For example, the first KFLD field following a KLIST operation is associated with the leftmost (high-order) field of the composite key.

Figure "KLIST and KFLD Operations" shows an example of the KLIST operation with KFLD operations.


[ Top of Page | Previous Page | Next Page | Table of Contents ]