IBM RPG

RPG
Report Program Generator
ParadigmMulti-paradigm
DeveloperIBM
First appeared1959
Stable release
RPG IV version 7 release 2 / May 2, 2014 (2014-05-02)
Typing disciplineStrong, static
OSCPF, SSP, OS/400, IBM i, OS/VS1, z/OS, DOS/VSE, VSE/SP, VSE/ESA, z/VSE, VS/9, PRIMOS, OpenVMS, Wang VS, Burroughs MCP, Windows
Dialects
RPG, RPG II, RPG III, RPG 400, RPG IV, RPG/ILE; RPG/Free, Baby/36, Baby/400, Lattice RPG
Influenced by
9PAC, FARGO
Influenced
RPG II

RPG is a high-level programming language (HLL) for business applications. RPG is an IBM proprietary programming language and its later versions are available only on IBM i- or OS/400-based systems.[1]

It has a long history, having been developed by IBM in 1959 as the Report Program Generator - a tool to replicate punched card processing on the IBM 1401[2] then updated to RPG II for the IBM System/3 in the late 1960s, and since evolved into an HLL equivalent to COBOL and PL/I.

It remains a popular programming language on the IBM i operating system, which runs on IBM Power platform hardware. The current version, RPG IV (a.k.a. ILE RPG), provides a modern programming environment.

Overview

An RPG program once typically started off with File Specifications, listing all files being written to, read from or updated, followed by Data Definition Specifications containing program elements such as Data Structures and dimensional arrays, much like a "Working-Storage" section of a COBOL program or "var" statements in Pascal. This is followed by Calculation Specifications, which contain the executable instructions. Output Specifications can follow which can be used to determine the layout of other files or reports. Alternatively files, some data structures and reports can be defined externally, mostly eliminating the need to hand code input and output ("I/O") specifications.

In the early days of RPG, its major strength was known as the program cycle: every RPG program executes within an implied loop, which can apply the program to every record of a file. At that time each record (individual punched card) would be compared to each line in the program, which would act upon the record, or not, based upon whether that line had an "indicator" turned "on" or "off" — from a set of logical variables numbered 01–99 for user-defined purposes, or other smaller sets based upon record, field, or report processing functions. The concept of level breaks and matching records is unique to the RPG II language, and was originally developed with card readers in mind.

Since the introduction of the System 38 in 1979 most RPG programmers discontinued use of the cycle in favor of controlling program flow with standard looping constructs, although IBM has continued to provide backward compatibility for the cycle.

Other Languages