Problem solve Get help with specific problems with your technologies, process and projects.

Reorganize with CPYF *REPLACE

This tip increased the users speed by 2000% !

You can increase the speed of your CPYF replace by changing all of the logical files that are based on the destination physical file to MAINT(*REBLD) and then changing them back to MAINT(*IMMED) after the CPYF completes. I recently did this on a file that had a whopping 55 logicals and the speed increase of 2000% was so large that I just had to let everyone know how I did it.

  /*copy FILEA to FILEB with replace*/

CHGLF FILE(lib/logicalfile) MAINT(*REBLD)  /*do for each logical that is based on physical file of destination fileb for cpyf*/

CPYF FILE(fileA) TOFILE(fileb) MBROPT(*REPLACE)  /*wow this is really fast now*/

CHGLF FILE(lib/logicalfile) MAINT(*IMMED) /*do for each logical that was changed above*/ 


The Best Web Links: tips, tutorials and more.

Ask your programming questions--or help out your peers by answering them--in our live discussion forums.

Ask the Experts yourself: Our application development gurus are waiting to answer your programming questions.

Dig Deeper on iSeries CL programming

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.