cpyf on multiple files

15 pts.
Tags:
CPYF
i need to copy all of the records from all of the files in one libray to a diff libray (add the records - joning two lib's into one - how can I do this with out running the job 3000+ times

Software/Hardware used:
as400 r5v4

Answer Wiki

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

Hi,

You may try using the CRTDUPOBJ command specifying *ALL for OBJ and and *YES for DATA parameters. Eg:

CRTDUPOBJ OBJ(*ALL) FROMLIB(fromlib) OBJTYPE(*FILE) TOLIB(tolib) DATA(*YES)

Also you might wish to submit the job instead of calling it interactively as there are too many files. It could take a while.
Cheers!

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
  • philpl1jb
    1. Use the dspfd to create an outfile listing all the physical files in the library .. if you use the mbrlist option I think it will list the number of records .. so you can determine which need to be copied 2. Write a short CL to read each record in the outfile and if the number of records is greater than 1 then copy it to the file in the final library with add option. Good luck Phil
    49,550 pointsBadges:
    report
  • TomLiotta
    I have an old web site that could be helpful. See the 'List Processing' functions from my on-lines Files page. Some of the stuff there is almost 20 years old, but the list processors are still very useful. A lot of the rest is just stuff I needed to learn what HTML and web sites were years ago. Download and compile the list set. Use the BLDFLST command to build a list of files. Then process that list with PRCFLST, using BLDMBRLST as the command to run against the file list and build a list of members, adding each file's members to the list being built. Then process the member list with PRCMBRLST; set CPYF as the command to run against the member list. A basic CL sequence with the list processing functions would look something like:
    BLDFLST FILE( MyLib/*ALL ) FILEATR(*PF)
    PRCFLST CMD( BLDMBRLST FILE( @@L/@@F ) LSTOPT(*FILE *ADD))
    PRCMBRLST CMD( CPYF FROMFILE( @@L/@@F ) TOFILE( ToLib/@@F ) FROMMBR( @@M )
                   TOMBR(*FROMMBR) MBROPT(*ADD) ERRLVL(*NOMAX) )
    Once the commands and their underlying programs are uploaded and compiled, that would copy every member of every physical file in library MyLib to the matching members in library ToLib. The intermediate file and member lists could be editted with SQL, or DFU, or however you chose, to do whatever cleanup you needed after each of the first two steps. CL is a powerful scripting language that is nicely extensible. Tom
    125,585 pointsBadges:
    report
  • Runelf
    In a CL, DSPOBJD of the FromLib to an out file. Read the outfile. Do a CHKOBJ on the the ToLib. If the object exists, CPYF MBROPT(*ADD), if it doesn't CPYF CRTFILE(*YES) MBROPT(*REPLACE)
    40 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