On 17 Dec 2012 16:13, Keith McCully wrote:
Actually, I tried CPYF *MAP first of all. Got a message complaining
that the number of fields didn't match between the files.
Does CPYF *MAP only work if ALL fields in the TO file get populated
from the FROM file? I believe it's okay to have additional fields in
FROM file that are not in the TO file but those could be removed
using the *DROP option.
The CPYF FMTOPT(*MAP) does indeed require that all fields in the
TOFILE exist in the FROMFILE. The CPYF FMTOPT(*NONE) does too, but also
requires the formats are effectively identical [see parameter help text
for the special value *NONE] such that no "mapping" is required between
the fields of the same name.
To effect both mapping *and* ignoring any /extra/ fields in the
FROMFILE [into which no field exists for the data to be mapped], include
the *DROP special value along with the *MAP special value on the Format
Option (FMTOPT) parameter [which allows multiple, compatible, element
specifications]; i.e. use:
CPYF FMTOPT(*MAP *DROP)
Unfortunately [in v5r3 anyhow] the CPF2965 does not allude to the
above combination of special values as an additional possibility for
recovery; i.e. suggesting only that recovery would be possible
specifying either "FMTOPT(*DROP) or FMTOPT(*NOCHK)" :-(