how to copy tables between two libraries without repeat cpyf command using script?

5 pts.
Tags:
CPYF
iSeries v7r1
I need to copy tables from library to another on the same iSeries v7.1, is there a script to copy multible tables without repeat cpyf command???

Software/Hardware used:
as 400,

Answer Wiki

Thanks. We'll let you know when a new response is added.

We’ve created a generic CL program which accepts 2 parameters. The first parameter is the “From” Library and the 2nd parm is the “TO” Library. The “TO” library is the library that you want to copy the data to and of course the “From” is where it’s coming from. We do a chkobj to verify that both libraries exist then we do a display object description DSPOBJD of all files in that library to an outfile. We do an ovrdbf to that outfile and then rcvf. We then check the object attribute and if it’s not a type PF we just skip it and read the next one. We continue doing this and when we get to a PF we do a cpyf. We have monitor message for empty files and we count the number of files read in and the number of files copied and log this at the end. It’s pretty simple but works well when you are trying to refresh data from one environment to another for testing or QA.

Discuss This Question: 3  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • WoodEngineer
    You could put the library names in a data base file, then ready that file in a CL program and issue a CPYF for each record.
    6,875 pointsBadges:
    report
  • WoodEngineer
    My apologies . . . that shoud have said "put the table names in a data base file".
    6,875 pointsBadges:
    report
  • TomLiotta
    ...is there a script to copy multible tables without repeat cpyf command? First, you can create any "script" you want. It's likely that no one has ever created a script that would copy your files, though. Copying files from one library to another can take some work because there are many types of files. Different types may need different handling. However, under some lucky circumstances, you can use a single command:
    CPY OBJ( '/qsys.lib/mylib.lib/abc*.file' )
        TODIR( '/qsys.lib/newlib.lib' )
        SUBTREE(*ALL)
    That will copy all files with names beginning "ABC" in library MYLIB to a library named NEWLIB. At least, it will copy many such files -- some file types don't copy easily. I strongly suggest that you run a series of tests of the CPY command before trying to copy sets of files with it. It might teach a lot about things that might trip up any "script". Tom
    125,585 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following