We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

Cannot copy file on AS/400 due to members error

netwrked
netwrked asked
on
Medium Priority
4,592 Views
Last Modified: 2013-12-06
Trying to use CPYF to copy a file from one library to another.  The code we are using changes the member of the file so it becomes a date identifier.  The command string looks like this:

CLRPFM FILE

CPYF FROMFILE(FROMLIB/FILE) TOFILE(TOLIB/FILE) FROMMBR(FILE) TOMBR(X063009X01) MBROPT(*REPLACE) FMTOPT(*NOCHK)

When the command executes, I get:

Members for file FILE more than maximum allowed
Member X063009X01 not added to file because of error

I thought that CLRPFM clears the file and member, but apparently that is not the case.  I also thought that the *REPLACE would let me overwrite the member.   The MAXMBRS on the file is set to 1.  

Any  help would be appreciated!

Thanks,

Joe
Comment
Watch Question

Gary PattersonVP Technology / Senior Consultant
CERTIFIED EXPERT

Commented:
Clearing a member does not remove it, just makes it empty.  My guess is that you are clearing member "A", and then trying to add member "B".  If the name of the existing member (DSPFD *MBRLIST) is different from the name of the new member, remove the member first (RMVM) or make sure and specify the same name on the CPYF command.

The error "Member ... NOT ADDED to the file because of error" is the giveaway - the system is trying to add a member to the file, and it is already at it's limit of one member.

BTW, there is not need to CLRPFM a member if you are going to CPYF *REPLACE that same member.  that is what *REPLACE does - automatically clear before copying.  Also no need to CPRPFM before RMVM.

Hope that helps.


- Gary Patterson

Author

Commented:
OK,  I tried the RMVM command on the file and it successfully removed the member, verified using DSPFD.  I tried my exact same copy command, this time I get:

Member X063009X01 added to file FILE in TOLIB
Empty member FILE in file FILE in library FROMLIB is not copied
Copy command ended because of an error

But, when I do the DSPFD (*MBRLIST), it shows the member as X063009X01 which is what I wanted.  Is there any way to get this command to work without erroring out?  It is bart of a batch of jobs that run and it keeps hanging up waiting for input (C I R D)

Thanks,

Joe
VP Technology / Senior Consultant
CERTIFIED EXPERT
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
Good information, thanks!
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.