Est. 1979 Intermediate

CL for AS/400

IBM's Control Language for the AS/400 (IBM i) platform - the system administration and job control language that has managed IBM midrange operations since 1979.

Created by IBM Rochester Development Laboratory

Paradigm Procedural, Imperative
Typing Static, Weak
First Appeared 1979
Latest Version CL on IBM i 7.5 (2022)

CL (Control Language) is the system administration and job control language for the IBM i platform, formerly known as the AS/400. Developed by IBM’s Rochester Development Laboratory in Minnesota, CL provides the primary interface to the operating system, managing everything from job scheduling and file operations to user profiles and system configuration. It has been an integral part of IBM’s midrange computing platform since the System/38 launched in 1979.

History & Origins

CL was created as part of the Control Program Facility (CPF), the operating system for the IBM System/38. The System/38 was announced on October 24, 1978, with first customer shipments reportedly beginning in late 1979 or early 1980. CL shipped as part of CPF from the beginning, providing operators and administrators with a consistent, command-driven interface to system resources.

The Rochester Lab

The IBM Rochester Development Laboratory in Rochester, Minnesota was responsible for the System/38 and its successors. Key figures in the System/38 project included Frank Soltis and Glenn Henry, though CL was a product of the broader development team rather than attributed to specific individuals. The System/38 reportedly represented approximately eight years of development work.

From System/38 to AS/400

When IBM launched the AS/400 (Application System/400) in June 1988, CL carried forward as the system control language under the new OS/400 operating system. The transition preserved CL’s command structure while expanding its capabilities to match the AS/400’s broader feature set. This continuity meant that system administrators familiar with CL on the System/38 could transition to the AS/400 with minimal retraining.

Naming Through the Years

The platform has been rebranded several times, but CL has remained the constant system control language throughout:

  • System/38 (1979) - CPF
  • AS/400 (1988) - OS/400
  • iSeries (2000) - OS/400
  • System i (2006) - i5/OS
  • IBM i (2008-present) - IBM i

Design Philosophy

CL was designed to serve a role analogous to JCL (Job Control Language) on IBM mainframes, but with significantly greater capability as a programming language. Where JCL is primarily a job description language, CL is a full procedural language that can control program flow, handle errors, manipulate data, and interact with nearly every aspect of the operating system.

Verb-Noun Command Structure

CL commands follow a consistent verb-noun naming convention using standardized abbreviations:

VerbMeaningNounMeaning
CRTCreatePGMProgram
DSPDisplayUSRUser Profile
CHGChangeLIBLibrary
WRKWork withJOBDJob Description
DLTDeleteOUTQOutput Queue
SNDSendMSGMessage

This pattern means that knowing the abbreviation conventions lets administrators predict command names. For example, DSPUSRPRF displays a user profile, CHGJOBD changes a job description, and CRTLIB creates a library.

Named Parameters

Unlike positional-parameter shells such as Unix sh or DOS CMD, CL uses named parameters that can be specified in any order:

1
CRTLIB LIB(MYLIB) TYPE(*PROD) TEXT('Production library')

Every CL command supports interactive prompting (via the F4 key on a 5250 terminal), which reveals all available parameters, their default values, and valid choices. This makes CL highly discoverable - administrators can explore commands without memorizing parameter lists.

Key Features

Compiled Programs

Although CL is often compared to scripting languages, CL programs are compiled, not interpreted. The CRTCLPGM (OPM) or CRTBNDCL (ILE) command compiles CL source into executable program objects. This generally gives CL programs better runtime performance than typical interpreted scripts.

Variables

Variables are declared with the DCL command and prefixed with an ampersand (&). All declarations must appear at the top of the program, after the PGM command:

1
2
3
4
5
6
7
8
9
PGM
  DCL VAR(&NAME)   TYPE(*CHAR) LEN(50)
  DCL VAR(&COUNT)  TYPE(*DEC)  LEN(5 0)
  DCL VAR(&ACTIVE) TYPE(*LGL)
  DCL VAR(&INDEX)  TYPE(*INT)  LEN(4)

  CHGVAR VAR(&NAME) VALUE('Hello, World!')
  SNDPGMMSG MSG(&NAME)
ENDPGM

Supported data types include:

TypeKeywordDescription
Character*CHARCharacter string (up to 9999 bytes in OPM, 32767 in ILE)
Decimal*DECPacked decimal (up to 15 digits in OPM, 24 in ILE)
Logical*LGLBoolean (‘0’ or ‘1’)
Integer*INTSigned integer (2, 4, or 8 bytes) - added in V5R3
Unsigned Integer*UINTUnsigned integer - added in V5R3
Pointer*PTRPointer variable - added in V5R4

Control Structures

CL provides standard control flow constructs, though several were added in later releases:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
/* IF/ELSE */
IF COND(&STATUS *EQ 'ACTIVE') THEN(DO)
  SNDPGMMSG MSG('User is active')
ENDDO
ELSE CMD(DO)
  SNDPGMMSG MSG('User is inactive')
ENDDO

/* SELECT/WHEN (similar to CASE) */
SELECT
  WHEN COND(&TYPE *EQ 'A') THEN(CALLPGM PGMA)
  WHEN COND(&TYPE *EQ 'B') THEN(CALLPGM PGMB)
  OTHERWISE CMD(CALLPGM PGMDEFAULT)
ENDSELECT

/* DOFOR loop (added V5R3) */
DOFOR VAR(&I) FROM(1) TO(10)
  SNDPGMMSG MSG('Iteration ' *CAT &I)
ENDDO

Message Handling

One of CL’s most distinctive features is its message handling system. Programs communicate through message queues, and the MONMSG command provides exception handling:

1
2
3
4
5
6
PGM
  DLTF FILE(MYLIB/TEMPFILE)
  MONMSG MSGID(CPF2105) /* File not found - ignore */

  SNDPGMMSG MSG('Processing complete') TOPGMQ(*EXT)
ENDPGM

The MONMSG command can monitor for specific message IDs or ranges, providing granular error handling similar to try-catch blocks in modern languages.

File Operations

CL can read database files using the DCLF (Declare File) and RCVF (Receive File) commands:

1
2
3
4
5
6
7
8
9
PGM
  DCLF FILE(CUSTLIB/CUSTFILE)

  DOWHILE COND('1')
    RCVF
    MONMSG MSGID(CPF0864) EXEC(LEAVE) /* End of file */
    SNDPGMMSG MSG(&CUSTNM)
  ENDDO
ENDPGM

The ILE Era

The introduction of the Integrated Language Environment (ILE) in the mid-1990s was a significant milestone for CL. ILE CL programs (created with CRTBNDCL) gain access to:

  • Subprocedures: Modular, callable units within a program
  • Service programs: Shared code libraries callable from multiple programs
  • Activation groups: Scoping mechanisms for program resources
  • Binding: The ability to bind CL modules with RPG, COBOL, and C modules into a single program

ILE allowed CL to participate as a peer alongside RPG, COBOL, and C in mixed-language applications, rather than being limited to a “glue” role calling other programs.

CL’s Role in the IBM i Ecosystem

CL occupies a specific niche in the IBM i language ecosystem:

  • RPG handles business application logic and data processing
  • COBOL serves legacy batch processing and financial calculations
  • CL manages system operations, job control, and program orchestration
  • SQL handles database queries and data manipulation

A typical IBM i shop uses CL to schedule jobs, set up runtime environments, manage libraries, handle errors at the system level, and call RPG or COBOL programs that perform the actual business processing. CL programs often serve as the entry point for batch job streams, setting up the environment before calling application programs.

Platform Availability

CL is exclusively tied to the IBM i operating system on IBM Power hardware:

PlatformSupport
IBM i (Power Systems)Full - native environment
WindowsNot available
macOSNot available
LinuxNot available
DockerNo image available

There is no open-source CL implementation or emulator for other platforms.

Accessing IBM i

To write and run CL programs, you need access to an IBM i system:

  • PUB400.COM - A free public IBM i system for learning, with reportedly over 40,000 registered users as of 2024
  • IBM Power Virtual Server - Cloud-based IBM i instances on IBM Cloud
  • Physical IBM Power hardware - On-premises systems

CL Today

CL remains actively used and enhanced on IBM i. IBM reportedly ships over 2,000 built-in CL commands with the operating system, covering virtually every aspect of system management. IBM i 7.5, released in May 2022, is the current generally available release, and IBM continues to deliver CL enhancements through Technology Refreshes.

The language has evolved considerably from its System/38 origins. Features added in V5R3 (2004) and V5R4 (2006) - including loops, subroutines, pointers, and data structures - transformed CL from a simple command scripting facility into a capable procedural language. While RPG and SQL handle most application development, CL remains indispensable for system administration, job scheduling, and operational automation on the IBM i platform.

Why It Matters

CL represents a design philosophy where the system control language is a first-class, compiled programming language rather than an afterthought scripting facility. Its consistent verb-noun command structure, named parameters, and interactive prompting made it remarkably discoverable for its era. The language demonstrates that system administration tools can be both powerful and learnable when designed with consistent conventions.

As one of the key languages of the IBM midrange ecosystem, CL has quietly powered the operational backbone of thousands of enterprises for over four decades. The businesses that depend on IBM i - in banking, retail, manufacturing, healthcare, and insurance - rely on CL programs to keep their critical systems running.

Timeline

1979
CL debuts as part of CPF (Control Program Facility) on the IBM System/38
1988
AS/400 launches with OS/400; CL continues as the primary system control language
1994
ILE (Integrated Language Environment) CL introduced with OS/400 V3R1, enabling modular CL programs
2000
AS/400 rebranded to eServer iSeries; CL gains incremental enhancements
2004
V5R3 delivers major CL enhancements: DOWHILE, DOUNTIL, DOFOR loops and integer data types
2006
V5R4 adds subroutines (SUBR/ENDSUBR), pointers, and data structures to CL
2008
IBM Power Systems introduced; OS renamed to IBM i, with CL continuing as the system control language
2010
IBM i 7.1 released with 8-byte integer support and additional CL enhancements
2022
IBM i 7.5 released with continued CL support and security enhancements

Notable Uses & Legacy

Banking and Financial Services

Core banking operations, transaction processing, and batch job scheduling on IBM i systems at financial institutions worldwide.

Retail and Distribution

System administration for point-of-sale, inventory management, and order fulfillment systems running on IBM i.

Manufacturing

Job scheduling, system automation, and ERP system administration on IBM i-based manufacturing operations.

Healthcare

System operations management for hospital billing, insurance claims processing, and patient records systems on IBM i.

Insurance

Batch processing orchestration and system administration for policy management and claims processing systems.

Language Influence

Influenced By

IBM JCL

Running Today

Run examples using the official Docker image:

docker pull none

Example usage:

# CL requires IBM i - no Docker image available
Last updated: