RPG/400 Help

KLIST (Define a Composite Key)

*---------*---------------*-----------------*----------------*---------------*
|   CODE  |    FACTOR 1   |     FACTOR 2    |     RESULT     |  INDICATORS   |
|         |               |                 |      FIELD     |               |
*---------*---------------*-----------------*----------------*---------------*
| KLIST   | KLIST name    |                 |                |               |
*---------*---------------*-----------------*----------------*---------------*

The KLIST operation is a declarative operation that gives a name to a list of KFLDs. This list can be used as a search argument to retrieve records from files that have a composite key.

You can specify a KLIST anywhere within 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. Factor 1 must contain a unique name.

Remember the following when specifying a KLIST operation:

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

KLIST and KFLD Examples

Figure 35. KLIST and KFLD Operations

*...1....+....2....+....3....+....4....+....5....+....6....+....7...
A*  DDS source
A          R RECORD
A            FLDA           4
A            SHIFT          1  0
A            FLDB          10
A            CLOCK#         5  0
A            FLDC          10
A            DEPT           4
A            FLDD           8
A          K DEPT
A          K SHIFT
A          K CLOCK#
A*
*...1....+....2....+....3....+....4....+....5....+....6....+....7...
CL0N01N02N03Factor1+++OpcdeFactor2+++ResultLenDHHiLoEqComments++++++
C*
C*  The KLIST operation indicates the name, FILEKY, by which the
C*  search argument can be specified.
C           FILEKY    KLIST
C                     KFLD           DEPT
C                     KFLD           SHIFT
C                     KFLD           CLOCK#


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