×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Copying One Record Content To Another Record Format

Copying One Record Content To Another Record Format

Copying One Record Content To Another Record Format

(OP)
Is there a simple way of copying an entire record to another file record?

I have two files that are the same format except for the field names.  Each field has the same length in both formats and I need to set each field in file 2 from each field in file 1.

I'm looking for a MOVE RECORD command or an EVAL option that will copy the entire record in onestep rather than me having to code an EVAL for each field in the file.

Dazed and confused.

Remember.. 'Depression is just anger without enthusiasum'.
 

RE: Copying One Record Content To Another Record Format

what you do is a copyfile. The example below copies file kytrucks from the jimlib to a file called kytruck2 in the jimlib the FMTOPT ( of *nochk ), says copy I will be responsilbe for the data. You should also use the the replace option of (*replace).   enter cpyf and press Command 4, for a prompt screen,, complete the first screen, then press command 10, and page down a few times to see the FMTOPT.  

CPYF FROMFILE(JIMLIB/KYTRUCKS) TOFILE(JIMLIB/KYTRUCK2) FMTOPT(*NOCHK)
                                                                       

RE: Copying One Record Content To Another Record Format

(OP)
Not quite what I'm after.  I want to copy data within an RPG program for a specific record.  Issuing a CL command would be way to inefficient ( QCMDEXEC ).

Dazed and confused.

Remember.. 'Depression is just anger without enthusiasum'.
 

RE: Copying One Record Content To Another Record Format

so you want to do this on a reoccuring basis,, when some conditions happens.. you want to replace the record in file 2, with the one from file 1.  

RE: Copying One Record Content To Another Record Format

If the field names differ by only the first few characters, use the PREFIX keyword to rename the fields of one of them to be the same as the other.

Alternatly, you can rename the individual fields for one of them in the I-specs, and then you just read the input file and write the output file.

-- Francis
I'd like to change the world, but I can't find the source code.

RE: Copying One Record Content To Another Record Format

How about defining a DS for each file format, the just EVAL DS2 = DS1 ?

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close