Home >> Computers >> Programming >> Languages >> RPG




RPG or even RPG IV occurs as native programming language for IBM's iSeries (aka AS/400) minicomputer system. Its latest incarnation includes prototyped functions & procedures, static & dynamic binding, access to C routine libraries, dynamic link libraries, and fully recursive and re-entrant code.

Overview

RPG (aka RPG IV aka RPGLE) is the mainstay programing language of the IBM iSeries platform. Originally intentional as the interrogation thing, IBM has enhanced a language to get a good-fledged, right programing language.

An RPG program generally starts murder by using the File Specification, list tons files existence written to, page through from either or even updated, followed by the Information Definition Specification containing program elements rather Information Structures & miscreate arrays (very much like the "Working-Storage" part of the COBOL program or even volt-ampere statements within the C program). This is followed per Calculation Specification, which contains a actual meat of the code. Output Specifications may watch which may be utilized to determine a layout of a report or even the report may be defined externally.

In a early times of RPG, its major nature and severity was referred to as the program period': every RPG program executes within an implied loop, which can apply the program to every record of a file. Alternately, the cycle can make an interactive program continue to run until explicitly stopped. Today, most RPG programmers avoid using the cycle in favor of controlling the flow of the program with standard looping constructs.

History
RPG is one of the few languages created for punch card machines that is still in common use today. This is because the language has evolved considerably over time. It was originally developed by IBM in the 1960s and ran on the popular IBM 1401. Originally, RPG was an acronym for Report Program Generator, descriptive of the purpose of the language: generation of reports from data files, including matching record and sub-total reports.

The alternative languages generally available at the time were either COBOL or BASIC: one verbose, the other a poor tool for development, so RPG became pre-eminent on IBM hardware.

RPG was further developed by IBM for their range of mainframe systems, especially the S/390 - as RPG II.

Because the language syntax was based on the plug-boards used to program unit record equipment, and the System/3 was initially developed as a successor to plug-board programmable unit record machines, RPG II was ported to the System/3, System/32, System/34, and System/36, while an improved version of the language, RPG III, was created for the System/38 and its successor the AS/400 (a mid-range machine, now evolved into the eServer iSeries) and became RPG/400 with a much cleaner syntax, and tighter integration with the integrated database. This language became the mainstay of development on the AS/400, and its editor was a simple line editor with prompt templates for each specification (type of instruction).

RPG III significantly departed from the original language, providing modern structured constructs like IF-ENDIF blocks, DO loops, and subroutines.

In 1994, RPG IV (aka RPGLE aka RPG/ILE) was released and the name, officially, was no longer an acronym. RPG IV offered a greater variety of expressions within its new Extended Factor-2 Calculation Specification.

In 2001, with the release of i5/OS V5R1, RPG IV offered even greater freedom for calculations than offered by the Extended Factor-2 Calculation Specification: a free-format text-capable source entry, as an alternative to the original column-dependent source format. The "/FREE" calculation does not require the operation code to be placed in a particular column; the operation code is optional for the EVAL and CALLP operations; and syntax generally more closely resembles that of mainstream, general-purpose programming languages.

Today, RPG IV is a considerably more robust language. Editing can still be done via the simple editor or it can edited via PC using IBM's Websphere Development Studio. IBM is continually extending it capabilities and adding more built-in functions (BIFs). It has the ability to link to Java objects (See [http://publib.boulder.ibm.com/infocenter/iseries/v5r3/ic2924/books/c092508415.htm#HDRDOBJECT IBM's RPG Reference Manual] ), and OS/400 APIs; it can be used to write CGI programs server on the iSeries. And yet, it retains a great deal of backward compatibility. So an RPG program written 20 years ago could run today with little or no modification.

Example code
The following program receives a customer number as an input parameter and returns the name and address as output parameters.

* Historically RPG is columnar in nature, though free-formatting * is allowed under particular circumstances. * The purpose of various lines code are determined by a * letter code in column 6. * An asterisk (*) in column 7 denotes a comment line

* "F" (file) specs define files and other i/o devices FARMstF1 UF E Disk Rename(ARMST:RARMST)

* "500" specs are used to define variables D pCusNo S 6p 0 D pName S 30a D pAddr1 S 30a D pAddr2 S 30a D pCity S 25a D pState S 2a D pZip S 10a

* "One hundred" (calculation) specs are used for executable statements * Parameters are defined using plist and parm opcodes C *entry plist C parm pCusNo C parm pName C parm pAddr1 C parm pAddr2 C parm pCity C parm pState C parm pZip

* The "chain" command is used for random access of a keyed file C pCusNo chain ARMstF1

* If a record is found, move fields from the file into parameters C if %found C eval pName = ARNm01 C eval pAddr1 = ARAd01 C eval pAddr2 = ARAd02 C eval pCity = ARCy01 C eval pState = ARSt01 C eval pZip = ARZp15 C endif * RPG makes use of switches. One switch "LR" stands for * "previous record". This ends program execution. C eval *InLR = *On

The same program using free calculations:

      * "F" (file) specs define files and other i/o devices
     FARMstF1   UF   E             Disk    Rename(ARMST:RARMST)

* "500" specs are used to define variables and parameters * The "paradigm" for the program is in a separate file * allowing other programs to call it /copy cust_pr * The "procedure interface" describes the *ENTRY parameters D getCustInf PI D pCusNo 6p 0 const D pName 30a D pAddr1 30a D pAddr2 30a D pCity 25a D pState 2a D pZip 10a /free // The "chain" command is used for random access of a keyed file chain pCusNo ARMstF1;

// If a record is found, move fields from the file into parameters if %found; pName = ARNm01; pAddr1 = ARAd01; pAddr2 = ARAd02; pCity = ARCy01; pState = ARSt01; pZip = ARZp15; endif; // RPG makes use of switches. One switch "LR" stands for // "go record". This ends program execution. *InLR = *On; /end-free

de:RPG (Programmiersprache) es:Lenguaje de programación RPG it:RPG (linguaggio di programmazione) nl:RPG (programmeertaal)

J & C Migrations
Convert RPGII, RPGIII, RPG/400 and CPG applications to readable structured COBOL. Target environments include COBOL for MVS, MF COBOL, and ACUCOBOL-GT.

St. Louis AS/400
RPG programming, LAN integration, remote connectivity, hardware and software.

Mid Range Consulting/Systems of New England
Certified IBM Business Partner providing AS/400 training and consulting on RPG, RPGIII, RPG/400, RPGIV, and ILE RPG.

RPG Alive
A tool for analyzing and modifying RPG source on iSeries (AS/400). RPG-Alive speeds up the development of applications by adding graphical elements to the OS/400 Programming Development Environment (PDM).

ASNA, Inc.
Amalgamated Software of North America focuses on Windows and Web development environments for AS/400 and Microsoft NT/2000 Server. Products: Visual RPG/Caviar (AVR), Acceler8DB, DataGate/400; Database Toolbox for C++, Java, VB. San Antonio, Texas; European offices.

RPGIV.com
RPG focused forum for AS/400 developers.

Function Junction
170+ preprogrammed ILE sub-procedures including date, string, math, data queue, array, time, statistics, finance functions for the iSeries AS/400.

Capricorn Information Systems
Information technology firm specializing in application development for AS/400 and iSeries customers using VisualAge RPG.

Bryan Meyers iSeries RPG IV Training
Bryan Meyers, author of "RPG IV Jump Start" and "Programming in RPG IV," offers RPG IV and ILE training and books for the iSeries (AS/400) platform.

RPG Toolbox
BY Linoma Software allows you to modernize your RPG programs, write applications faster and maintain source code more effectively. It was designed and developed by RPG programmers for RPG programmers.


Computers: Companies: Software Development: Mainframes
Computers: Programming: Languages: Procedural
Computers: Software: Operating Systems: Midrange: OS-400




© 2005 GeneralAnswers.org