Difference between revisions of "Category:RPG"
(Made sweeping changes to the section comparing RPG to other languages, and especially the spurious "defense" of RPG as object-oriented.) |
m (Add link to RPGPGM.COM in external links) |
||
Line 130: | Line 130: | ||
== External Links == | == External Links == | ||
* RPG Developer Network http://www.rpgiv.com/ | * RPG Developer Network http://www.rpgiv.com/ | ||
+ | * RPGPGM.COM RPGPGM.COM — An extensive resource of articles giving examples of RPG code and related programming https://www.rpgpgm.com | ||
* "RPG: A Great Language with a Greater History" by Brian Kelly, The Four Hundred, Volume 18, Number 30 -- August 17, 2009 [http://www.itjungle.com/tfh/tfh081709-story01.html] | * "RPG: A Great Language with a Greater History" by Brian Kelly, The Four Hundred, Volume 18, Number 30 -- August 17, 2009 [http://www.itjungle.com/tfh/tfh081709-story01.html] | ||
Revision as of 14:19, 8 June 2019
RPG is an acronym which stands for Report Program Generator. It is a programming language developed by IBM originally created for developing business applications.
- See also on Wikipedia: RPG programming language
Programmers, coming to RPG from other programming environments, will still need to get some education to familiarize themselves with its capabilities, and how it functions.
There are four major versions of RPG currently in use... RPG II, RPG III, RPG 400, and RPG IV (sometimes referred to as ILE RPG). The latter has two distinctive flavors: the traditional column restricted language entry and the modern /Free alternative where most of the coding can be entered in a non-column restricted way.
RPG is almost exclusively limited to IBM midrange platforms. Various RPG implementations have been developed for other platforms over the years including the IBM 1401, System/360, S/370 and follow-ons; the Hewlett Packard HP3000 [1]; as well as Wang, Sperry, Burroughs, and Digital PDP and VAX computers. These can all be considered niche projects with very little adoption, especially the ones outside IBM.
OS/400 contains extensive support for debugging and run-time identification of RPG code. There is a large established base of RPG code in production environments, usually performing heavy-lifting batch-oriented data tasks, or providing support for interactive ERP applications, either with native 5250 interface or with a graphical user interface (GUI) or Web Skin applied over the 5250 data stream.
Contents
RPG vs. other languages
Compared to other programming languages, RPG is especially strong in
- transactional processing;
- access to the integrated Db2 database on the IBM i platform;
The main criticisms of RPG center around the language not having enough "modern" features, such as support for object-oriented programming (OOP). However, the language continues to evolve and improve, and already compares favorably with most languages in terms of procedural programming support.
Another area of criticism is lack of direct support for GUI programming, though there are RPG Third Party offerings to fill that gap.
RPG vs. Java
Arguably the biggest difference between these two languages, as used for "business" programming, is that Java is explicitly object-oriented while RPG is not. Java also has a very large ecosystem of third-party packages, most of which are free and open-source, while RPG (as yet) has a very small ecosystem by comparison.
Both coexist and interoperate well on the IBM midrange platform, allowing businesses to leverage the respective strengths of each language on the same machine.
Objects and RPG
This seems to be a persistent bone of contention among those who try to portray RPG as object-oriented, apparently due to some perceived need to "keep up with the Joneses". However, RPG is not object-oriented in any way which would be recognizable to programmers of languages with explicit support for OOP, such as Java, C++, C#, Python, Ruby, Smalltalk, etc.
RPG is about as object-oriented as C or Pascal, which is to say you could use pointers and data structures to create your own notion of "objects". However, this is far more cumbersome and less robust than using the explicit, built-in object-oriented mechanisms (such as classes and inheritance) in the languages recognized by the rest of the computing world as "object-oriented".
What the "RPG-is-object-oriented" proponents invariably describe as object-oriented features are better understood to the rest of the world as modular programming features. In particular, the ILE environment and ILE-related language improvements bring GCC-style modularity and language interoperability to the IBM midrange.
APIs
API stands for Application Program Interface. RPG has access to C functions via service programs in binding directory QC2LE, as well as CEE APIs. There are also APIs specific to IBM i, like IFS access.
A new API mechanism is called IBM Rational Open Access: RPG Edition [1] Open Access is a separately purchased product for IBM i 6.1 and above via handlers similar to using SPECIAL files.
Conditional compilation
Conditional compilation is a mechanism that allows you to include or omit sections of code based on the compilation environment. This is in contrast to editing the code to add or remove sections. A typical reason for conditional compilation is code only used during testing. Imagine a scenario where you're writing a program that will perform a web service. Putting it in debug might be problematic because halting on a breakpoint will stop all web users from seeing results. So you insert code that logs useful information to an IFS file. Unfortunately, leaving that code in all the time slows execution down too much. One solution is conditional compilation.
Conditional compilation uses condition-names as the main driver. In conjunction with condition-names, compiler directives /IF, /ENDIF, /ELSE and /ELSEIF are used to perform the tests the compiler will use to determine whether to include a section of code or not. Condition-names can be predefined by the compiler, or defined by the developer via /DEFINE and /UNDEFINE. There is one last directive, /EOF, which tells the compiler to ignore any remaining source lines in the source member.
An example might make this easier.
/if defined(LOG_FULL) logDebug('customer credit code': creditCode) logDebug('customer A/R balance': %editc(balance: 'J') /endif
If LOG_FULL is defined, either in the compile command: DEFINE(LOG_FULL), or within the source code: /DEFINE LOG_FULL then this logging code is included and compiled. If LOG_FULL is not defined, that code is not compiled.
RPG comes with some useful predefined condition-names:
i5/OS version | Condition-name | Purpose |
---|---|---|
V5R4 | *CRTRPGMOD | Set if the compilation command is CRTRPGMOD |
V5R4 | *CRTBNDRPG | Set if the compilation command is CRTBNDRPG |
V5R4 | *VxRxMx | Set if the TGTRLS on the compile command is this level OR LATER. For example, if *V5R4M0 is specified, it will evaluate true if TGTRLS is V5R4, 6.1, 7.1 or higher. |
Examples:
/if defined(*CRTBNDRPG) H dftactgrp(*no) actgrp('MYCOMPANY') /endif
/if defined(*V5R4M0) callp someV5R4API(); /else callp ourHandWrittenVersion(); /endif
This article is a stub. You can help by editing it.
Learning about RPG
- Four Reasons RPG Geezers Should Care About The New Free-Form RPG
- The Geezer's Guide to Free-Form RPG, Part 2: Data Structures and More
- The Geezer's Guide to Free-Form RPG, Part 3: Data Structures and More Data Definitions
- The Geezer's Guide To Free-Form RPG, Part 4: Prototypes and Procedure Interfaces
- The Geezer's Guide to Free-Form RPG, Part 5: File Definitions
- Trying fully free RPG
- Using SEU with totally free RPG
- Coding in Free-Form RPG IV - a beginner's tutorial
- Calling a program in totally free RPG
- Practical RPG: Techniques for Procedures
- The equivalent of MOVEA in all free RPG
- Example subfile program using modern RPG
- Free-form RPG support on IBM i
- Surprises in the New Free Format RPG
- RPG is free at last!
- New RPG Free-Format operations
- Defining variables in RPG all free
- Deep dive into RPG free-form
Open Source Sites
- http://iseries-toolkit.sourceforge.net/
- http://www.scottklement.com/oss.html
- http://www.martinvt.com/Code_Samples/code_samples.html
- http://Netshare400.com
- http://www.think400.dk (Danish)
- http://home.alltel.net/craigru/jcrcmd2.html
- http://sourceforge.net/projects/iseriestoexcel
- http://www.rpgiv.com/downloads/
- http://www.code400.com
- http://mowyourlawn.com/
- http://www.rpgnext.com/tutorials.php
- http://www.rpgunit.org
- http://www.opensource4i.com/
External Links
- RPG Developer Network http://www.rpgiv.com/
- RPGPGM.COM RPGPGM.COM — An extensive resource of articles giving examples of RPG code and related programming https://www.rpgpgm.com
- "RPG: A Great Language with a Greater History" by Brian Kelly, The Four Hundred, Volume 18, Number 30 -- August 17, 2009 [2]
References
- ↑ IBM United States Software Announcement 210-114 , IBM Rational Open Access: RPG Edition delivers RPG IV extensibility to access new devices and resources ,13 Apr 2010. Retrieved on 19 Apr 2010
Subcategories
This category has the following 2 subcategories, out of 2 total.
Pages in category "RPG"
The following 33 pages are in this category, out of 33 total.