How to Check If an IBM i Command Is Used on Your System: Spotlight on PRTCMDUSG
If you’ve been working with IBM i (formerly known as AS/400 or iSeries) for any length of time, you know the system is packed with commands thousands of them, from built-in ones like CPYF (Copy File), WRKACTJOB (Work with Active Jobs), SIGNOFF (which… erm.. Signs you Off) to custom creations. But what if you need to figure out if a specific command is actually being used on your system? Maybe you’re cleaning house, auditing for security, or just curious about dependencies before making changes.
Enter PRTCMDUSG, the Print Command Usage command. This handy tool helps you scan for where commands are referenced in your CL (Control Language) programs and modules. It’s not about tracking real-time executions (we’ll touch on that later), but rather a static analysis to see if the command appears in your code base.
Think of it as a cross-reference checker that can save you from breaking things accidentally.
Why Bother Checking Command Usage?
Before we dive in, let’s talk motivation. IBM i systems often accumulate legacy code over years or decades!
If a command’s definition changes due to an OS upgrade or PTF (Program Temporary Fix) you might need to recompile affected programs. PRTCMDUSG shines here by listing which programs use specific commands, helping you identify what needs attention. Plus, it’s useful for security audits or decommissioning unused commands without surprises.
What Is PRTCMDUSG?
PRTCMDUSG stands for Print Command Usage. It’s a CL command that generates a printed report (or spooled file) showing a cross-referenced list of specified commands and the CL programs or ILE CL modules where they’re used. It searches through your libraries for matches, making it a great way to answer: “Is this command embedded anywhere in my code?”
Searches CL programs and modules: Focuses on static command calls in Control Language code.
Supports multiple commands: You can check up to 50 at once.
Flexible program selection: Scan specific programs, generics, or entire libraries.
This command can take a while to run on large systems and might produce a hefty output file, so plan accordingly!

