What is IBM i Control Language?

  • Home
  • /
  • Blog
  • /
  • What is IBM i Control Language?

January 26, 2026

What is IBM i Control Language?

By NickLitten

January 26, 2026

CL, IBM i, programming

If you’ve spent any time around IBM i systems, you’ve probably heard the term “Control Language” or “CL” thrown around. But what exactly is Control Language? And why should you, a modern programmer in 2026, care about it?

Grab a cuppa, and let’s dive in.

What is Control Language (CL)?

In the simplest terms, Control Language (CL) is IBM i’s scripting language for system operations. Think of it as the command line interface on steroids, or like shell scripting for Unix/Linux systems, but specifically designed for IBM i. CL allows you to:

  • Call programs and procedures (both IBM-supplied and user-written)
  • Manage objects (files, programs, libraries, etc.)
  • Control job flow and handle errors
  • Work with system resources (memory, devices, etc.)
  • Automate system administration tasks

Every command in CL follows a consistent structure, which makes it surprisingly easy to learn once you understand the pattern.

A Brief History: From AS/400 to IBM i

CL has been around since the AS/400 days (late 1980s). When IBM introduced the AS/400, they needed a way for administrators and programmers to interact with the system. As the AS/400 evolved into the iSeries, then System i, and finally IBM i, CL evolved right along with it. Today, it’s still a fundamental part of the operating system.

IBM i AS400 iSERIES CL Control Language

CL Commands: The Building Blocks

CL commands all follow a consistent naming convention made up of a verb and an object type:

Common Verb Prefixes:

  • CRT – Create (e.g., CRTPF – Create Physical File)
  • DLT – Delete (e.g., DLTF – Delete File)
  • WRK – Work with (e.g., WRKOBJ – Work with Objects)
  • DSP – Display (e.g., DSPLIB – Display Library)
  • CHG – Change (e.g., CHGPF – Change Physical File)
  • CPY – Copy (e.g., CPYF – Copy File)
  • STR – Start (e.g., STRDBG – Start Debug)
  • END – End (e.g., ENDJOB – End Job)

Object Types:

  • PF – Physical File
  • LF – Logical File
  • PGM – Program
  • LIB – Library
  • JOB – Job
  • USRPRF – User Profile

So, when you see CRTPF, you immediately know it means “Create Physical File.” It’s like learning a new language, but one that’s surprisingly consistent.

Types of CL Programs

There are two main types of CL programs:

1. CL Programs (CLP)

These are the original, compiled CL programs with source type CLP, compiled using CRTCLPGM.

2. CLLE Programs (CLLE)

These are ILE CL programs with source type CLLE, compiled using CRTCLPGM with ILE options.

For new development, use CLLE. It’s the modern standard and plays nicely with ILE concepts.


What Can You Do With CL?

1. Call Programs and Pass Parameters

This example shows a CL program calling an RPG program, passing parameters, and handling errors with MONMSG.

PGM PARM(&CUSTNO &MODE)
  DCL VAR(&CUSTNO) TYPE(*DEC) LEN(7 0)
  DCL VAR(&MODE) TYPE(*CHAR) LEN(1)
  
  CALL PGM(CUSTMNT) PARM(&CUSTNO &MODE)
  MONMSG MSGID(CPF0000) EXEC(GOTO ERROR)
  RETURN
  
ERROR:
  SNDPGMMSG MSG('Error calling CUSTMNT program')
ENDPGM

2. Work with Objects

This shows how CL can create and manipulate objects.

PGM
  CRTLIB LIB(MYNEWLIB) TYPE(*PROD)
  CRTPF FILE(MYNEWLIB/CUSTMAST) +
          SRCFILE(QDDSSRC)
  CPYF FROMFILE(OLDLIB/CUSTMAST) +
         TOFILE(MYNEWLIB/CUSTMAST)
  SNDPGMMSG MSG('Library and file created')
ENDPGM

3. Control Job Flow

CL can submit jobs, wait for completion, and check status.

PGM
  SBMJOB CMD(CALL PGM(DAILYPROC)) +
         JOB(DAILY) +
         JOBQ(QBATCH)
  DLYJOB DLY(30)
  WRKJOB JOB(DAILY)
ENDPGM

CL vs RPG: When to Use What?

Use CL when you need to:

  • Control program flow and call other programs
  • Manage system objects (files, libraries, jobs)
  • Handle errors and exceptions
  • Automate administrative tasks
  • Create menus and user interfaces

Use RPG when you need to:

  • Perform complex calculations
  • Process large amounts of data
  • Create detailed reports
  • Work with database records
  • Implement business logic

In most real-world applications, you’ll use both. CL programs often act as “wrappers” that call RPG programs and handle the overall flow.

Modern CL: What’s New and Exciting?

CL isn’t stuck in the 1980s. IBM has continued to enhance it:

1. DCLF (Declare File) Support

You can now declare and work with files directly in CL:

PGM
  DCLF FILE(QADSPOBJ) OPNID(OBJ)
  RTVOBJD OBJ(MYLIB/*ALL) OBJTYPE(*ALL) +
            OBJD(*OUTFILE) OUTFILE(QADSPOBJ)
  DOWHILE COND(&OBJ_EOF *EQ '0')
    RCVF OPNID(OBJ)
    MONMSG MSGID(CPF0864) EXEC(LEAVE)
    SNDPGMMSG MSG('Object: ' *CAT &OBJ_OBNAM)
  ENDDO
  CLOF OPNID(OBJ)
ENDPGM

2. Better Variable Support

Modern CL supports longer variable names and more data types:

DCL VAR(&LONG_VARIABLE_NAME) TYPE(*CHAR) LEN(256)
DCL VAR(&COUNTER) TYPE(*INT) LEN(4) VALUE(0)
DCL VAR(&SUCCESS_FLAG) TYPE(*LGL) VALUE('0')

Writing Your First CL Program

Here’s a simple “Hello World” style program:

/* HELLOCL.CLLE - My first CL program */
PGM
  SNDPGMMSG MSG('Hello from Control Language!')
  SNDPGMMSG MSG('Press Enter to continue...') +
            MSGTYPE(*INFO)
ENDPGM

Compile and Run:

CRTCLPGM PGM(MYLIB/HELLOCL) SRCFILE(MYLIB/QCLSRC)
CALL PGM(MYLIB/HELLOCL)

Congratulations! You’ve just written, compiled, and run your first CL program.

CL Best Practices

1. Always Declare Your Variables

/* Good - explicit declarations */
DCL VAR(&CUSTNO) TYPE(*DEC) LEN(7 0)
DCL VAR(&STATUS) TYPE(*CHAR) LEN(1) VALUE('A')

2. Handle Errors Gracefully

CALL PGM(IMPORTANT) PARM(&PARAM1 &PARAM2)
MONMSG MSGID(CPF0000) EXEC(DO)
  SNDPGMMSG MSG('Important program failed') +
            MSGTYPE(*ESCAPE)
  RETURN
ENDDO

3. Use Meaningful Variable Names

/* Good - descriptive names */
DCL VAR(&CUSTCODE) TYPE(*DEC) LEN(7 0)

4. Keep It Simple

CL is meant for control and coordination. Don’t try to do complex calculations or heavy data processing in CL. Use CL to call the right programs in the right order.

CL in the Modern World: Is It Still Relevant?

Absolutely yes! Here’s why:

1. It’s Everywhere

Walk into any IBM i shop, and I guarantee you’ll find CL programs. Understanding CL helps you understand how the system works.

2. It’s Essential for System Administration

If you’re a system administrator on IBM i, CL is not optional. You need it to manage users, monitor the system, handle backups, and perform countless other tasks.

3. It Plays Well with Modern Tools

CL works great with modern development tools like VS Code’s Code for IBM i extension.

4. It’s Not Going Anywhere

IBM continues to enhance CL with each new release of IBM i. It’s a fundamental part of the operating system.

Common CL Commands You Should Know

Object Management

  • CRTLIB – Create Library
  • CRTPF – Create Physical File
  • DLTF – Delete File
  • WRKF – Work with Files

Program Control

  • CALL – Call a Program
  • CRTPGM – Create Program
  • SBMJOB – Submit Job
  • ENDJOB – End Job

Job and Spooled File Management

  • WRKACTJOB – Work with Active Jobs
  • WRKSPLF – Work with Spooled Files

User and Security Management

  • CRTUSRPRF – Create User Profile
  • CHGUSRPRF – Change User Profile

The Bottom Line

Control Language is a fundamental skill for anyone working with IBM i systems. Whether you’re a programmer, system administrator, or just someone who needs to understand how IBM i works, CL knowledge is invaluable.

It’s not the newest or flashiest technology, but it’s rock-solid, reliable, and deeply integrated into the IBM i operating system. Learning CL will make you more effective at your job and give you a deeper appreciation for how IBM i systems work.

So don’t be intimidated by those cryptic three-letter commands. Embrace them! Learn them! Master them! Your future self (and your resume) will thank you.

Now, if you’ll excuse me, I’m going to write a CL program to automate my morning coffee routine. Because that’s the kind of thing we IBM-i CL programmers do!

What is IBM CL?

IBM i Control Language (CL) is a powerful scripting language for the IBM AS/400, IBM iSeries and IBM i Systems. It’s got roots in the older IBM Job Control Language, and it works as a simple way to script commands, instructions and other functions into an easy-to-understand programs.

{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}

Join the IBM i Community for FREE Presentations, Lessons, Hints and Tips

>