I know how to copy records from one pf to another by reading one file in dow loop and writing into another file like below. Files are PF1 and PF2 having record format rec1 and rec2 respectively where each file have only one field named fld1 and @fld1 respectively-
READ PF1
DOW not %eof(PF1) and not %error
eval fld1 = @fld1
write Rec2
READ PF1
ENDDO
If you need to use RPG, use embedded SQL. Look up INSERT INTO. If you aren't limited to RPG, consider CPYF... MBROPT(*ADD).
What business problem are you trying to solve by doing it another way?