Solved

Cannot copy file on AS/400 due to members error

Posted on 2009-07-02
4
3,064 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
0
Comment
Question by:netwrked
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 35

Expert Comment

by:Gary Patterson
ID: 24765878
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
0
 

Author Comment

by:netwrked
ID: 24767175
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
0
 
LVL 35

Accepted Solution

by:
Gary Patterson earned 500 total points
ID: 24776137
Well, just like the error says, your From Member "FILE" in your From File "FROMFILE/FILE" is empty.  Personally, I think this behavior (CPYF fails on empty from member when *REPLACE is specified) sucks, and that the command should not fail, but hey, they didn't ask me.
 
Is this a mistake or a  bug in an earlier step, or is it normal to have an empty member here?

Lost of things you can do:  

You can modify your CL to ignore the "Copy commanded ended because of error (CPF2817)" message using a MONMSG statement right after the CPYF command, but this has the unfortunate consequence of causing your program to ignore all copy failures.  That might be bad.

You could clear the target member first, and then use the CPYF *ADD option - I don't think it will fail on an empty member in that case.  (This is probably the easiest thing to do if it is OK for the member to be empty).

You could, check to make sure that there are records in the From member before attempting to copy (RTVMBRD NBRCURRCD parameter).

You could perform the copy, and if it fails, check through diagnostic messages (RCVMSG) to see if it failed due to the "Empty member" message (CPF2869).  This process is a little tricky, since there can be a lot of messages on the message queue, and it can be a little tricky to know which go with that command.

- Gary Patterson

0
 

Author Closing Comment

by:netwrked
ID: 31599246
Good information, thanks!
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In a recent article here at Experts Exchange (http://www.experts-exchange.com/articles/18880/PaperPort-14-in-Windows-10-A-First-Look.html), I discussed my nine-month sandbox testing of the Windows 10 Technical Preview, specifically with respect to r…
I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.
Suggested Courses

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question