RPG
By IBM
RPG, short for Report Program Generator, is a business-application programming language developed by IBM that runs primarily on IBM i (formerly AS/400) midrange systems. Originally built for generating printed business reports from file…
Definition
RPG, short for Report Program Generator, is a business-application programming language developed by IBM that runs primarily on IBM i (formerly AS/400) midrange systems. Originally built for generating printed business reports from file data, it evolved into a full application development language with database access, structured control flow, and free-form syntax, and it remains widely used to maintain long-running business applications in industries such as manufacturing, finance, and distribution.
Overview
RPG began in the 1960s as a tool for automating the generation of business reports, translating column-oriented specifications into printed output directly from data files without requiring a programmer to write general-purpose procedural code. This report-centric origin shaped its distinctive early syntax, organized into fixed-format specification lines for input, calculation, and output, which differed sharply from the free-flowing statement style of languages like COBOL or FORTRAN being developed around the same period. Over successive IBM midrange platforms, from the System/3 through the AS/400 and into today's IBM i, RPG evolved considerably while retaining backward compatibility with older programs. Modern RPG, often called RPG IV or ILE RPG, adds free-format syntax resembling more conventional programming languages, native support for SQL embedded directly in source code, and integration with IBM i's integrated database, DB2 for i, which is tightly coupled to the operating system rather than existing as a separate database product. RPG programs commonly define record structures matching physical database files and use built-in operations for indexed file access alongside newer SQL-based data manipulation. Among business-oriented legacy languages, RPG is often compared to COBOL, since both target enterprise data processing and both remain in heavy production use on legacy systems, though RPG is specific to IBM's midrange platform while COBOL runs more broadly across mainframes and other systems. RPG differs from general-purpose languages in that its core strengths, fixed-format specifications, native file handling, and deep database integration, exist specifically to serve business reporting and transaction processing rather than broader software development. In practice, organizations that adopted IBM midrange systems decades ago, particularly in manufacturing, wholesale distribution, and financial services, continue to run substantial RPG codebases handling core operations like inventory management, order processing, and accounting. IBM i shops frequently combine RPG with newer web and API layers, using RPG for the underlying business logic and database access while presenting modern interfaces to users through separate technologies. The language's main limitation is its narrow platform scope: RPG expertise and code are tied almost entirely to IBM i, so the skill does not transfer to other environments the way knowledge of more portable languages does, and finding new developers willing to learn RPG has become harder as the language's visibility outside its niche has declined. Many organizations running RPG systems face a long-term choice between modernizing existing code with newer RPG features and SQL integration, or eventually rewriting core logic in a more broadly supported language.
Key Features
- Originated as a report-generation tool from file-based data
- Free-format RPG IV syntax alongside legacy fixed-format specifications
- Native embedded SQL for accessing DB2 for i directly
- Tight integration with the IBM i integrated database
- Built-in indexed file access operations for record processing
- Backward compatibility across decades of IBM midrange platforms
- Modular program structure through the Integrated Language Environment
- Strong fit for business transaction and reporting workloads