CPF4101: File not found or inline data file missing
CPF4101 means a program tried to open a file and the system couldn't find it, either in the library named or anywhere in the job's library list. The open fails, so the program can't use the file at all.
Other names for this code
Also written as CPF4101 file not found, MSGID CPF4101, not found or inline data file missing, error message CPF4101 appeared during OPEN, RNQ1216 CPF4101, CPF4101 *LIBL.
What it means
CPF4101 is an escape message sent when a file is opened. Its text names the file and the library and ends with "not found or inline data file missing." The library often shows as *LIBL. That means the program asked for the file by name only and the system searched the job's library list without finding it.
IBM groups CPF4101 with the open messages from CPF4101 to CPF43FF. Each of these means the open failed and the file can't be used. The program never gets to read or write a record.
The second half of the message text refers to inline data files. Those are data records placed straight into a batch input stream. Most shops never use them, so in practice the message means the file itself wasn't found.
The program usually reports the failure in its own words as well. An ILE RPG program that opens the file at startup gets file status 01216, and its default handler sends the inquiry RNQ1216 with the text "Error message CPF4101 appeared during OPEN for file" followed by the file name. In ILE COBOL the open returns file status 35, or 05 for a file declared OPTIONAL.
Common causes
- The library that holds the file isn't in the job's library list. This is the most common cause, and it often shows up only in one kind of job.
- A batch or scheduled job runs with a different library list from the user who tested it. Submitted and scheduled jobs take their starting library list from the job description, so a library added by hand in an interactive session is missing there.
- An earlier program in the job changed the library list, for example with RMVLIBLE or CHGLIBL, before this program opened the file.
- A file override (OVRDBF) points the open at a file or library that doesn't exist.
- An RPG program uses the EXTFILE keyword, and the name it holds at run time is misspelled or names the wrong library.
- The program expects a work file in QTEMP. QTEMP belongs to one job, so a file created there by a different job, or by a step that didn't run, isn't visible.
- The file was deleted, renamed or not yet restored, for example on a new test system.
- A database server job such as QZDASOINIT or QZRCSRVS runs the program for a remote client and has its own library list, which doesn't match the one the developer used.
How to find the problem
- Run DSPJOBLOG and put the cursor on CPF4101. Press F1 to see the file name and the library. If the library is *LIBL, the library list is the first suspect.
- Run
DSPLIBLin the failing job, or look at the library list on the WRKJOB screen for a batch job, and check whether the file's library is there. - Find where the file actually lives with
WRKOBJ OBJ(*ALL/ORDHDR) OBJTYPE(*FILE). - Run
DSPOVRin the job to see whether an override redirects the file. DSPOVR lists overrides that are active at that moment, so run it at the point where the program fails, for example from a debug break. - For a scheduled or submitted job, check the job description with
DSPJOBDand look at its initial library list (INLLIBL). - For a client or web application, look in QSYSOPR and in the server job's log. The inquiry may come from a QZDASOINIT or QZRCSRVS job rather than the job the developer expects.
How to fix it
- Add the missing library to the library list with
ADDLIBLE ACCTLIBfor a one-off fix, or add it to the job description withCHGJOBD JOBD(ACCTLIB/so every job that uses it gets the library.PAYJOBD) INLLIBL(...) - Correct or remove the override that points at the wrong file or library.
- Create the file if it is supposed to exist, or restore it from the last save.
- For a QTEMP work file, make sure the step that creates it runs in the same job as the program that opens it.
What it looks like
File ORDHDR in library *LIBL not found or inline data file missing. Error message CPF4101 appeared during OPEN for file ORDHDR (C S D F).
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(CPF4101) MSGF(QSYS/QCPFMSG)
Also inspect the full job log and second-level message text, including substitution values.
Related codes
Questions
The file exists, so why do I get CPF4101?
Because the job that failed can't see it. The file's library is missing from that job's library list, or an override points somewhere else. Compare DSPLIBL in the failing job with the library where WRKOBJ finds the file.
Why does it work interactively but fail in batch?
A submitted or scheduled job builds its library list from its job description, not from your current session. Add the library to the job description's INLLIBL, or to the library list in the CL program the job runs.