Are you trying to copy all of the data or after you change some fields in the from file? A cpyf with *nochk will allow you to copy all the data with a selection capability if needed. You can use cpyfrmqryf after doing an opnqryf, then there is the SQL insert. In side a RPGLE you can try the "eval ToIm = FrmIm" or setup two external data structures D FromDs E Ds ExtName(FIm101) Rename(From) D ToDS E Ds ExtName(FIm102) Rename(To) and do a "eval ToDs = FromDs"
Unconfigured Ad Widget
Collapse
Announcement
Collapse
No announcement yet.
Copying Data from one Record Format to Another
Collapse
X
-
Copying Data from one Record Format to Another
Stuart, Yeah, I know I could do it with cpyf, but I need the logic inside of RPG4. I had already tried Move, but that isn't allowed. I tried Eval specifying the record format names, but that isn't either (at least not in V4R5). I don't really understand your example using external data structures. Is it possible that you made some naming mistakes? If not, then it looks like I would have to create some just for this purpose which doesn't seem worth it. Just to fill you all in with more of what's happening. I'm copying data from one file in a library to another file with the same layout in another library. There will be logic inside the program that will change some of the field data in this transfer depending upon certain criteria. There are way too many fields for them to be copied one by one, so I want to do a full copy, then overlay some of the field data as needed. Bill > In side a RPGLE you can try the "eval ToIm = FrmIm" or setup two external data structures > D FromDs E Ds ExtName(FIm101) Rename(From) > D ToDS E Ds ExtName(FIm102) Rename(To) > and do a "eval ToDs = FromDs"
Comment
-
Copying Data from one Record Format to Another
I have the following specs: FIiml01 ipe e k disk Rename(Ipi100im:FrIIM) Prefix(Fr) FIiml02 uf a e k disk Rename(Ipi100im:ToIIM) Prefix(To) Both files have the same layout, how can I copy all of the data from FrIIM to ToIIM? Bill
Comment
-
Copying Data from one Record Format to Another
Bill, Use the external ds example, just make the names inside the Extname be your filenames, I think they were just typos in Stuart's example. This is the simplest approach to doing it in your program. Scott Mildenberger
Comment
Comment