IBM i message

CPF2103: Library already exists in library list

CPF2103 means a command, usually ADDLIBLE, tried to add a library that is already on the job's library list. Nothing was changed, and the library stays where it was.

Other names for this code

Also written as CPF2103 library already exists in library list, MSGID CPF2103, ADDLIBLE CPF2103, MONMSG CPF2103, library already in library list.

What it means

CPF2103 is an escape message from QCPFMSG with the text "Library &1 already exists in library list". Each job on IBM i has a library list, the ordered list of libraries the system searches when a name is given as *LIBL. The list has a system part, product libraries, a current library and a user part. The user part can hold up to 250 libraries.

ADDLIBLE adds one library to the user part. A library can only appear once in the list, so if it is already there, ADDLIBLE refuses and sends CPF2103. The library list isn't changed. In particular, the library is not moved to the position the command asked for.

The message is almost always harmless. The library the program wanted is already available. The trouble starts when a CL program doesn't monitor for it. Because CPF2103 is an escape message, an unmonitored one turns into a function check (CPF9999), and the program stops over something that didn't need to stop it.

Common causes

  • A CL program runs ADDLIBLE for a library that the job description or an earlier step already put on the list.
  • The same program runs twice in one interactive session, and the first run already added the library.
  • A user typed ADDLIBLE for a library that is already on their list, perhaps one added by the initial program at sign-on.
  • The initial library list changed (job description INLLIBL or the QUSRLIBL system value) and now includes a library that programs still add by hand.

How to find the problem

  1. Run DSPLIBL to see the job's current library list and where the library already sits.
  2. In a batch job, look at the job log for the library list the job started with, and check the job description with DSPJOBD for its initial library list.
  3. If the message ended a program, open the job log with DSPJOBLOG and look for CPF9999 right after CPF2103. F1 and F9 on the function check show which program and statement ran the ADDLIBLE.

How to fix it

  • Monitor for the message straight after the command: ADDLIBLE LIB(ACCTLIB) followed by MONMSG MSGID(CPF2103). This is the standard way to write ADDLIBLE in CL.
  • If the library must be first in the list, remove it and add it again, for example RMVLIBLE LIB(ACCTLIB) with its own MONMSG, then ADDLIBLE LIB(ACCTLIB) POSITION(*FIRST).
  • To reorder the list by hand, use EDTLIBL and change the sequence numbers.
  • If many programs add the same library, consider putting it in the job description's initial library list instead, and remove the ADDLIBLE calls.

What it looks like

Library ACCTLIB already exists in library list.

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(CPF2103) MSGF(QSYS/QCPFMSG)

Also inspect the full job log and second-level message text, including substitution values.

Report a correction to WND Software.

Questions

Is CPF2103 an error I need to worry about?

Usually not. The library you wanted is already on the list. It only causes trouble when a program doesn't monitor for it and stops with a function check.

Does ADDLIBLE move the library to the top when it is already in the list?

No. ADDLIBLE sends CPF2103 and changes nothing. Remove the library with RMVLIBLE first, then add it at the position you want.

How many libraries can the user part of the library list hold?

Up to 250 on current IBM i releases. Older releases allowed far fewer.