I have two physical files are PF1 & PF2 ,in that i need to copy the records from PF! file to PF2 file but tw0 files have different field names and have same attributes.
Example:
PF1:
Name 25 A
Code 10 S 0
Location 30 A
PF2:
LCode 10 S 0
LLocation 30 A
LName 25 A
plz guide me and thanks in advance...
Software/Hardware used:
AS400
ASKED:
January 12, 2012 4:55 AM
UPDATED:
February 28, 2012 11:54 AM
Hi,
Use the fallowing command
CPYF FROMFILE(QTEMP/PF1) TOFILE(QTEMP/PF2) MBROPT(*ADD) FMTOPT(*NOCHK)
But Before Using this command your PF2 fiedl sequence is same as PF1 field sequence
you can:
Since the field names are different and the fields are in different locations, you can’t directly use simple tools like CPYF.
SQL could help though:
Then you can do this:
By creating a VIEW over PF1 that presents the columns with new names, you can use the *MAP option of the CPYF command.
Tom