CPF3203: Cannot allocate object for file
CPF3203 means a command couldn't get a lock it needed on a database file, one of its members or a related object such as a logical file, because another job held a conflicting lock. The message names the file and library.
Other names for this code
Also written as CPF3203 cannot allocate object, MSGID CPF3203, cannot allocate object for file, CLRPFM CPF3203, MONMSG CPF3203.
What it means
CPF3203 is an escape message with the text "Cannot allocate object for file &1 in &2." The Clear Physical File Member (CLRPFM) command lists it among its errors, and other commands that change database files report lock failures the same way.
"Allocate" is the IBM i word for getting a lock. A database file has several parts that can be locked on their own. They are the file object, each member, the data in each member, and the logical files and access paths built over it. A command that changes the file has to lock every part it touches in a strong enough state. Clearing a member, for example, empties the access paths of the logical files over it too, so a job reading through one of those logical files is in the way as well.
If another job holds a lock that conflicts, the command waits. When the wait runs out it stops and sends CPF3203, and the file is left as it was. The text names the physical file, but the busy object may be a member or a logical file. Diagnostic messages just before it in the job log often say which one.
Common causes
- A user or a batch program has the file open, either directly or through a logical file built over it.
- A database server job, such as QZDASOINIT for ODBC and JDBC clients, still has the file open from an earlier query.
- Another job holds a lock taken with ALCOBJ. Some applications lock their files for the whole day.
- A save is running against the library. Other jobs can read the file during a save but can't change it.
- Another command is changing the same file at the same moment, for example a CHGPF, a reorganize or an ALTER TABLE in another job.
- Your own job opened the file earlier and didn't close it, which blocks commands that need exclusive use.
How to find the problem
- Run DSPJOBLOG, put the cursor on CPF3203 and press F1 for the file and library. Read the diagnostic messages above it, which often name the member or logical file that was busy.
- Run
WRKOBJLCK OBJ(ACCTLIB/to see which jobs hold locks on the physical file and in what state.PAYMAST) OBJTYPE(*FILE) - Run
DSPDBR FILE(ACCTLIB/to list the logical files and SQL views built over it, and repeat WRKOBJLCK on each of them.PAYMAST) - For a job you suspect, run WRKJOB and take the option to work with open files to confirm it has the file open.
- On recent releases the SQL view QSYS2.
OBJECT_ LOCK_ INFO shows the same lock information and can be filtered by library and object name.
How to fix it
- Wait for the other job to finish, or ask its user to leave the program, then rerun the command. Nothing was changed, so a retry is safe.
- In CL, take the lock first with ALCOBJ and a WAIT value, run the command, then release the lock with DLCOBJ. A lock failure then shows up as CPF1002 at a point where the program can retry or tell the operator.
- Close the file in your own job with CLOF or RCLRSC, or have the RPG program that used it end with LR on.
- Move clears and reorganizations to a window when users, client connections and saves are off the file.
- Before ending a job that holds the lock, check what it is doing with the application owner. Ending a server job or an update program can lose a user's work.
What it looks like
Cannot allocate object for file PAYMAST in ACCTLIB.
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(CPF3203) MSGF(QSYS/QCPFMSG)
Also inspect the full job log and second-level message text, including substitution values.
Related codes
Questions
WRKOBJLCK shows no locks on the file. Why did I get CPF3203?
The busy object may be a logical file over it, not the physical file itself. Run DSPDBR to list the dependent files and check each of them with WRKOBJLCK.
What is the difference between CPF3203 and CPF1002?
CPF1002 is the message ALCOBJ sends when it can't get the lock you asked for. CPF3203 comes from a command that tried to lock a file on its own as part of its work, such as CLRPFM.
Is CPF3203 a sign of damage?
No. It is a timing problem between jobs. The file is fine, and the command usually works once the other job lets go.