PDA

View Full Version : KLIST and KFLD



Guest.Visitor
07-30-2002, 12:03 PM
In V5R1, you code a composite key using <code>KLIST</code> and <code>KFLD</code>. It's just that those opcodes have to be coded in fixed-form calcs. In V5R2, there are more options available to you. First, you can code the search arguments in the compound key directly in the keyed I/O statement. For example, "<code>chain (arg1: arg2: arg3+17) rec;</code>". Individual search arguments may be any expression, and have to match the corresponding keys in type only. Unlike KLIST's, 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 "<code>chain %kds(kds) rec;</code>". This is nice if you define the data structure using <code>extname(file:rec:*key)</code>, which defines the DS as an externally described data structure with just the key fields of the record as the subfields. The <code>%kds()</code> more closely approximates the <code>klist</code>, but the list of search arguments syntax is the more flexible.

Guest.Visitor
07-30-2002, 12:14 PM
Wow! Thanks, Hans.

Guest.Visitor
07-30-2002, 12:20 PM
on V5R1 free format programming, what would be the replacement for KLIST and KFLD? in other words, how would you define a composite key? thanks again, Maria

Guest.Visitor
07-30-2002, 12:20 PM
thanks again, Hans.