Language reference

RPG (IBM i / AS/400)

IBM i shops running RPG II through RPG IV and ILE, with a distinct dialect history under one green-screen roof.

History & foundation

Origin

RPG (Report Program Generator) was introduced by IBM in 1959 for the IBM 1401, built to let punched-card tabulator operators move to computers without retraining from scratch. Its predecessor, FARGO (Fourteen-o-one Automatic Report Generation Operation), had done the same job for a narrower set of machines. Both replicated the tabulator's cyclic processing model, reading a card, summarizing it, and printing a result, which is why early RPG reads nothing like a general-purpose language: it was not built to be one.

Design goals

RPG's defining feature, the program cycle, is inherited directly from punched-card machines: the runtime handles reading input and looping automatically, and the programmer fills in what happens to each record rather than writing the loop itself. That made it fast to write report-style business logic with minimal training, at the cost of looking foreign to programmers coming from any other language family. Later versions kept extending that same core into structured and eventually free-form syntax without ever fully discarding the cycle underneath it.

Standards timeline

  1. 1959 · RPG

    Original release for the IBM 1401, replacing punched-card tabulator workflows.

  2. ~1969 · RPG II

    Shipped with the IBM System/3 and later System/32, /34, /36; added data structures and subroutines.

  3. 1978 · RPG III

    Introduced with the IBM System/38; added structured constructs like IF-ENDIF blocks and DO loops.

  4. 1988 · RPG/400

    Renamed version of RPG III for the newly launched AS/400, with new opcodes like SCAN, CAT, and XLATE.

  5. 1994 · RPG IV / ILE RPG

    Released with OS/400 V3R2, introducing extended calculation specifications and full ILE integration with COBOL and C.

  6. 2001 · Free-form calculations

    V5R1 added the /FREE directive, letting calculation specs drop fixed-column syntax.

  7. 2013 · Fully free-form RPG

    V7R1 TR7 removed the need for /FREE markers, allowing entire programs in free-form syntax.

45,000+ companies

Organizations tracked as actively running IBM AS/400, iSeries, or IBM i worldwide.

ELP Data: IBM AS/400 Users List, 2025

10 million+ lines

Lines of RPG code IBM has fed into its Granite AI models to build RPG-aware development assistance.

IT Jungle: RPG Code Generation and the Agentic Future of IBM i, 2025

3.2% growth

IBM Power Systems hardware revenue growth in 2024, reaching 1.59 billion dollars, after years of decline.

IT Jungle, cited via 2025 IBM i market research

RPG (IBM i / AS/400) history and figures compiled from public sources, cited above. Corrections welcome.

CPFxxxx message IDs

View all 72
CPF9801IBM i / OS/400

Condition

Object not found. A referenced file, program, or object does not exist in the library named, or in any library on the current library list.

Fix

Check the library list (*LIBL) resolution order with DSPLIBL, confirm the object was not deleted, and confirm it is not sitting in a different environment's library than the one this job is pointed at.

CPF9812IBM i / OS/400

Condition

File not found. The file named in the message does not exist in the library named, distinct from CPF9801 in that this one is specific to files rather than any object type.

Fix

Confirm the file was actually created and exists in the library the job expects, and check for a typo in the file name or library qualifier in the program or CL command.

CPF4131IBM i / OS/400

Condition

Level check on file open. The record format ID for a file does not match the record format ID the program was compiled against. This usually means the file's field or key layout changed after the program was last compiled.

Fix

Recompile the program against the current file definition. If level checks already match in every environment you tested, check for a duplicate file earlier in the library list; a forum thread on Code400 traced exactly this cause when a batch job's library list picked up an older copy of the file before the current one.

CPF5029IBM i / OS/400

Condition

Data mapping error on file operation. A PUT or UPDATE through a logical file hit a data mapping error, commonly from a GROUP BY view, a field with a default value, or a null value present in a record where the program does not expect one.

Fix

Check whether the logical file involves GROUP BY or joins that do not support the write operation attempted, and confirm the physical file's null-capable fields are being handled explicitly in the program.

Frequently asked

Is RPG still used in 2026?+

Yes, RPG is still the primary business language on IBM i (formerly AS/400), with an installed base tracked at over 45,000 organizations worldwide.

What does RPG stand for?+

RPG stands for Report Program Generator. It was designed in 1959 to replicate punched-card tabulator report generation on early IBM computers.

What is the difference between RPG and RPG IV?+

RPG IV, released in 1994, added extended calculation specifications and full integration with COBOL and C under ILE. Free-form RPG syntax, added starting in 2001, is part of RPG IV, not a separate version.

Is RPG worth learning in 2026?+

For a career in IBM i shops specifically, yes: demand for RPG skills consistently outpaces the number of programmers entering the field. It is a narrow but durable niche, not a general-purpose skill.

Are IBM i shops still running literal green-screen terminals?+

Mostly not physical terminals anymore; most 5250 sessions run through PC-based emulation software rather than dedicated green-screen hardware. But the interface itself, whether emulated or physical, is increasingly a separate decision from the RPG code behind it: modernization vendors sell products specifically to convert 5250 screens into browser-based interfaces while leaving the underlying application logic untouched.

How big is a typical RPG development team?+

Often small. Industry reporting has long put the average IBM i shop at around three programmer/analyst/administrator staff total, and it's not unusual for one person to be responsible for the RPG applications, the database, and system administration simultaneously. A trade-press piece in August 2026 specifically framed that concentration, not headcount by itself, as the real operational risk in a small IBM i shop.

Is fixed-format RPG dead now that free-format exists?+

No. Free-format has been available since 2001 and fully free since 2013, but shops with large existing fixed-format codebases don't rewrite working programs just to change their format. On an active RPG forum thread about the debate, one developer summed up the practical calculus directly: doing 80% maintenance on code that's already fixed-format isn't a reason to convert it to all-free any time soon.

What's the single biggest concern for IBM i shops in 2026?+

IBM i skills availability, for the first time in nine years of Fortra's IBM i Marketplace Survey. It was cited by 69% of respondents in 2026, up from 60% in 2025, and it displaced cybersecurity from the top spot it had held every year since 2017.

Can RPG programs power a modern web application, or are they stuck behind a terminal screen?+

RPG business logic can run behind a modern web front end without being rewritten. This is the core idea behind IBM's own description of RPG modernization: convert or replace the interface, add web and API access, and modularize the code, while the RPG logic underneath keeps doing the same job it always did.

Why do RPG programmers keep debating free-format vs. fixed-format if IBM already settled it?+

Because the debate isn't really about which syntax IBM supports, it's about maintenance economics inside individual shops. New RPG development increasingly happens in free-format, since some newer operations only work fully there, but shops with decades of working fixed-format code have little incentive to convert it purely for style, which is why both styles coexist in practice rather than one replacing the other.

From the community

Real questions from public forum threads, with credit to who asked and who answered. Our answer restates the fix and links to the matching reference page where one exists.

Why do I get CPF4131 in batch when the level checks match everywhere I tested them?

Asked by dcutaia on Code400 forum, ongoing thread

There is another copy of the file higher in the library list, used during the end-of-day process, that has a different level ID than the one being tested against on the command line.

tomholden

Our answer

If a level check passes interactively but fails in batch, the file itself is probably not the problem. Check the library list the batch job actually uses; a duplicate file sitting earlier in that list will get opened first, and it can easily have a different level ID than the copy you tested against.

Full reference page →

Is free-format RPG actually easier to read than fixed-format, or is that just what people say?

Asked by rpgKnight on Code400 forum, ongoing thread

Free format is easily more readable than anything you can do in fixed format, once you are used to it.

MikeS

Mixing a few lines of free format into otherwise fixed-format code just makes it look like a mess; pick one and be consistent.

arrow483

Some operations, like a CHAIN with a composite key or EVAL-CORR, are only fully usable in free format, which pushes new development that direction regardless of preference.

B.Hauser

Our answer

The forum split roughly the way you would expect: developers who learned fixed format first find free format unfamiliar, and developers who learned it the other way round find fixed format needlessly rigid. The one point of actual agreement is not to mix them inside a single program. For anything new, free format also gets you syntax that fixed format cannot express at all, so it is the practical default for new work even if you keep maintaining fixed-format code elsewhere.

More on RPG