A: In V5R1, you code a composite key using KLIST and KFLD. It's just that those opcodes have to be coded in fixed-form calcs. Many people code their KLIST and KFLD opcodes at the beginning of their calculation specifications to put them closer to the definition specifications.
In V5R2, there are more options available to you. First, you can code the search arguments of the compound key directly in the keyed I/O statement. For example:
"chain (arg1: arg2: arg3+17) rec;"
Individual search arguments may be any expression, and they have to match the corresponding keys in type only. Unlike KLIST, RPG handles length and format conversion for the list of search arguments.
Second, you can define your search arguments as subfields of a data structure and code your I/O operation as "chain %kds(kds) rec;". This is nice if you define the data structure using "extname(file:rec:*key)", which defines the data structure as an externally described data structure with just the key fields of the record as the subfields.
The %kds() more closely approximates the KLIST operation code, but the list of search arguments syntax is more flexible. Note that these two options are available only in free-form calculations.