Use this field-level keyword when you want a field name in the logical record format that you are defining to be different from its corresponding physical file field name.
RENAME(physical-file-field-name)
The name as it appears in the physical file record format is the parameter value for this keyword. One field in the physical file record format can be renamed to more than one field in the record format being described.
If you specify the same physical field more than once in a record format in the logical file (that is, by using either RENAME or CONCAT), the sequence in which the fields are specified in the logical file is the sequence in which the data is moved to the physical file on an update or insert operation. Thus, the value in the last occurrence of the physical field is the value that is put in the physical record and is the value that is used for all keys built over that physical field. All previous values of the same field are written over and have no effect.
The following examples show how to specify the RENAME keyword.
In the following example, the QTYDUE field in the physical file (PF1) is renamed QTY in the logical file.
|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8 00050A R RCD1 PFILE(PF1) 00060A QTY RENAME(QTYDUE) A
In the following example, the renamed field in the logical file (QTY) is used as a key field.
|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8 00050A R RCD2 PFILE(PF2) 00060A : A : 00130A QTY RENAME(QTYDUE) 00140A K QTY A