CPF3130: Member already in use
CPF3130 means a command needed exclusive use of a database file member, usually to clear it, but a job still had the member open or locked. The message names the member, and nothing is changed.
Other names for this code
Also written as CPF3130 member already in use, MSGID CPF3130, member already in use, CLRPFM CPF3130, MONMSG CPF3130.
What it means
CPF3130 is an escape message with the text "Member &2 already in use." The Clear Physical File Member (CLRPFM) command lists it among its errors, and a nightly CLRPFM in a CL program is where most people meet it.
The records of a physical file live in its members. Clearing a member throws all of its records away in one go. The system won't do that while another program could be reading or changing them, so the command needs the member to itself. If any job has the member open, or holds a lock on it, the command waits for a while. Then it gives up and sends CPF3130. The member is left exactly as it was.
The job in the way is often another user or a batch job. It can also be your own job. A program that ran earlier in the same job and didn't close the file still has the member open, and that is enough to block the clear.
Common causes
- An interactive user has the file open, for example someone left on an inquiry or update screen in an order entry program.
- Your own job still has the file open. An RPG program that returned with LR off, a file opened with OPNDBF and never closed with CLOF, or a shared open data path (SHARE(*YES)) all keep the member in use.
- A database server job has the file open. SQL connections from ODBC, JDBC or similar clients run in server jobs such as QZDASOINIT, and these can keep a file open after a query ends so they can reuse it.
- Another job took a lock on the file or member with ALCOBJ and hasn't released it.
- A save of the library or file is running. A save lets other jobs read the file but not change it, so a clear has to wait for it to finish.
How to find the problem
- Run DSPJOBLOG, put the cursor on CPF3130 and press F1 to see the member and file. Check the messages just before it for the command that failed.
- Run
WRKOBJLCK OBJ(ACCTLIB/to list the jobs holding locks on the file. From that screen you can also look at member locks. Note each job's name, user and number.PAYMAST) OBJTYPE(*FILE) - For a job you suspect, run WRKJOB and take the option to work with open files. It shows every file the job has open and how many times.
- If the only job listed is your own, run
DSPJOB OPTION(*OPNF)in that job. A file still shown as open there is what blocks the clear. - On recent releases the SQL view QSYS2.
OBJECT_ LOCK_ INFO lists the same lock details and is easy to filter by library and file.
How to fix it
- Wait for the other job to finish or ask the user to leave the program, then run the command again. Nothing was cleared, so a retry is safe.
- In your own job, close the file first. Use CLOF for a file opened with OPNDBF, end the RPG program with LR on, or run RCLRSC to close files left open by programs that have already returned.
- In a CL program, take the lock before you clear:
ALCOBJ OBJ((ACCTLIB/, then CLRPFM, then DLCOBJ. If ALCOBJ fails you get a clear message (CPF1002) and can retry or alert the operator.PAYMAST *FILE *EXCL)) WAIT(60) - For a server job that holds the file, talk to the application owner before ending anything. Ending a QZDASOINIT job drops a user's connection.
- Schedule clears for times when interactive users and client connections are off the file, and add
MONMSG MSGID(CPF3130)with a retry loop so one busy moment doesn't stop the whole job stream.
What it looks like
Member PAYMAST already in use.
IBM documentation
IBM Display Message Descriptions (DSPMSGD). Use the documentation for your installed release.
This link opens the relevant IBM reference library or lookup instructions. Match the complete code and your installed product release; it is not a code-specific review.
Read the installed message description:
DSPMSGD MSGID(CPF3130) MSGF(QSYS/QCPFMSG)
Also inspect the full job log and second-level message text, including substitution values.
Related codes
Questions
WRKOBJLCK only lists my own job. Why do I still get CPF3130?
Your job still has the file open from an earlier program or an OPNDBF. Close it with CLOF or RCLRSC, or have the RPG program end with LR on, and run the clear again.
What is the difference between CPF3130 and CPF3203?
Both come from a lock conflict. CPF3130 says the member itself is in use. CPF3203 says the command couldn't allocate some object it needed for the file, which can be the file, a member or a related logical file.
Did CLRPFM delete any records before it failed?
No. The command stops before it clears anything, so the member keeps all its records.