IBM i message

CPD0030: Command not found

CPD0030 means IBM i couldn't find the command you entered. It isn't in the library named on the command, or, when the library is *LIBL, it isn't in any library on the job's library list.

Other names for this code

Also written as CPD0030 error, MSGID CPD0030, command not found IBM i, CPD0030 *LIBL, command in library *LIBL not found.

What it means

Every IBM i command is an object of type *CMD that lives in a library. When you type a command, or a program runs one, the system first has to find that object. Most commands are run unqualified, so the system searches the job's library list in order. If it reaches the end without finding a *CMD object of that name, it sends CPD0030. The text names the command and the library it searched, which is *LIBL for an unqualified command.

CPD0030 is a diagnostic message. It reports the problem while the command is being checked, before anything runs. When the command came from a program through QCMDEXC, or was checked as part of a larger request, an escape message such as CPF0006 usually follows, saying the command had errors. The real reason is still CPD0030.

The command may exist on the system in a library this job can't see. It may also not exist at all. IBM support describes a common case where WRKQRY, STRSQL or RUNSQLSTM give CPD0030 because the licensed program that supplies them isn't installed.

Common causes

  • The command name is misspelled, or uses a name from another system or another product.
  • The library that holds the command isn't on this job's library list. Vendor tools and in-house commands in their own libraries cause this most, and batch jobs hit it more than interactive ones because they get their library list from the job description.
  • The licensed program that supplies the command isn't installed, or one of its options is missing. IBM names Query (WRKQRY) and the DB2 Query Manager and SQL Development Kit (STRSQL, RUNSQLSTM) as typical cases.
  • The command was qualified with the wrong library, such as a test library on a production system.
  • The command was deleted or never copied when an application moved to a new system.

How to find the problem

  1. Put the cursor on the message and press F1. The help shows the exact command name and the library the system searched.
  2. Run WRKOBJ OBJ(*ALL/PAYCALC) OBJTYPE(*CMD) to see whether the command exists in any library on the system, and where.
  3. Run DSPLIBL in the same kind of job that failed and compare it with the library WRKOBJ found. For a batch job, check the job description's initial library list with DSPJOBD.
  4. For an IBM command such as STRSQL or WRKQRY, run GO LICPGM and take option 10 to list installed licensed programs, or use CHKPRDOPT to check the product, as IBM support suggests.
  5. If a program ran the command, look in DSPJOBLOG for the CPF0006 or other escape message after CPD0030, and F9 on it to see which program and statement sent the command.

How to fix it

  • Correct the spelling. Press F4 on a command you are unsure of to prompt it, which confirms the system can find it.
  • Add the command's library to the job with ADDLIBLE LIB(ACCTLIB). To fix it for good, change the job description's initial library list with CHGJOBD, or the user's initial program.
  • Qualify the command in programs and scheduled jobs, for example ACCTLIB/PAYCALC, so it doesn't depend on the library list.
  • Install the missing licensed program or option, then try again.
  • If the command was lost in a migration, restore or recreate it from its source with CRTCMD.

What it looks like

Command PAYCALC in library *LIBL not found.
Errors occurred in command.

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

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

Report a correction to WND Software.

Questions

Why does a command work for me but give CPD0030 for another user?

Each job has its own library list. The other user's job description or initial program doesn't include the library that holds the command.

Why do I get CPD0030 for STRSQL?

IBM support says this happens when the licensed program that provides STRSQL isn't installed on that system. Check with GO LICPGM option 10 or CHKPRDOPT.

What is the difference between CPD0030 and CPF0006?

CPD0030 is the diagnostic that says the command wasn't found. CPF0006 is the escape message that follows when a program ran the command, saying it had errors.