You define the input file within your RPG Specs
Then read through the file moving data to the fields in the output file and do a WRITE
Here is some sample code
FM25 IF F 34 DISK
FOutFile O E Disk
IM25 AA 01
I 1 34 Rec
Ouput = Rec;
*InLr = *On;
If your flat file is 34 characters wide, and your externally-described file is also 34 characters wide and has its field definitions lined up with the appropriate positions in the flat file, you use the CPYF command with the FMTOPT( *NOCHK ) parameter value set.
FMTOPT( *NOCHK ) tells CPYF to copy record images without checking field constraints.