词条 | IBM RPG | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
释义 |
| name = RPG Report Program Generator | logo = | paradigm = Multi-paradigm | year = 1959 | designer = | developer = IBM | latest_release_version = RPG IV version 7 release 2 | latest_release_date = {{Start date|2014|05|02}} | latest_test_version = | latest_test_date = | typing = Strong, static | implementations = | 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 | operating_system = CPF, 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, Microsoft Windows | license = | website = }}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. OverviewAn 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 IBM 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. HistoryRPG is one of the few languages created for punched card machines that are still in common use today. This is because the language has evolved considerably over time. It was originally developed by IBM in 1959. The name Report Program Generator was descriptive of the purpose of the language: generation of reports from data files, including matching record and sub-total reports. FOLDOC accredits Wilf Hey with work at IBM that resulted in the development of RPG.[3]FARGO (Fourteen-o-one Automatic Report Generation Operation) was the predecessor to RPG on the IBM 1401. Both languages were intended to facilitate ease of transition for IBM tabulating machine (Tab) unit record equipment technicians to the then new computers. Tab machine technicians were accustomed to plugging wires into control panels to implement input, output, control and counter operations (add, subtract, multiply, divide). Tab machines programs were executed by impulses emitted in a machine cycle; hence, FARGO and RPG emulated the notion of the machine cycle with the program cycle. RPG was superior to and rapidly replaced FARGO as the report generator program of choice. The alternative languages generally available at the time were Assembler, COBOL or FORTRAN. COBOL was a natural language-like business oriented language and FORTRAN was a language that facilitated mathematical applications. Other languages of the era included ALGOL and Autocoder and a few years later PL/I. Assembler and COBOL were more common in mainframe business operations (System/360 models 30 and above) and RPG more commonly used by customers who were in transition from tabulating equipment (System/360 model 20). Language evolutionRPG II was introduced with the System/3 series of computers. It was later used on System/32, System/34, and System/36, with an improved version of the language. RPG II was also available for larger systems, including the IBM System/370 mainframe running DOS/VSE (then VSE/SP, VSE/ESA, and z/VSE). ICL also produced a version on its VME/K operating system. RPG III was created for the System/38 and its successor the AS/400. RPG III significantly departed from the original language, providing modern structured constructs like IF-ENDIF blocks, DO loops, and subroutines. RPG III was also available for larger systems including the IBM System/370 mainframe running OS/VS1. It was also available from Unisys for the VS/9 operating system running on the UNIVAC Series 90 mainframes. DE/RPG or Data Entry RPG was exclusively available on the IBM 5280 series of data-entry workstations in the early '80s. It was similar to RPG III but lacking external Data Descriptions (DDS) to describe data(files) like on the System/38 and its successors. Instead, the DDS part had to be included into the RPG source itself. RPG/400 was effectively RPG III running on AS/400. IBM renamed the RPG compiler as "RPG/400" but at the time of its introduction it was identical to the RPG III compiler on System/38. Virtually all IBM products were rebranded as xxx/400 and the RPG compiler was no exception. RPG III compiled with the RPG/400 compiler offered nothing new to the RPG III language until IBM began development of new operation codes, such as SCAN, CAT and XLATE after several years of AS/400 availability. These enhancements to RPG III were not available in the System/38 version of RPG III. RPG IVRPG IV, a.k.a. RPGLE or ILE RPG,[4]) was released in 1994 as part of the v3r2 release of OS/400.[5] With the release of RPG IV, the RPG name was officially no longer an initialism. RPG IV offered a greater variety of expressions within its Extended Factor-2 Calculation Specification and, later in life, its free-format Calculation Specifications and Procedure syntax. RPG IV is the only version of RPG supported by IBM in its long line of successors to the AS/400 system (iSeries, System i, etc.). In 2001, with the release of OS/400 V5R1, RPG IV offered 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 did 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. Until November 2013, the free format applied exclusively to the calculation specifications.[6] With the IBM i V7R1 TR7 upgrade to the language, the "/free" and "/end-free" calculations are no longer necessary, and the language has finally broken the ties to punched cards. Today, RPG IV is a more robust language. While editing can still be done via SEU, the simple green screen editor (even though syntax checking is not supported for features introduced from IBM i V7R1 onward), a long progression of tools has been developed over time. Some of these have included Code/400 and Visual Age for RPG, which were developed by IBM. Currently the preferred editing platform is IBM's Websphere Development Studio client, (WDSc) now named RDi (Rational Developer for i), which is a customized implementation of Eclipse. Eclipse, and therefore RDi, runs primarily on personal computers and other devices. IBM is continually extending its capabilities and adding more built-in functions (BIFs). It has the ability to link to Java objects,[7] and i5/OS APIs; it can be used to write CGI programs with the help of IBM's Cgidev2 Web toolkit,[8] the Cozzi cozTools (a collection of RPG and CGI routines for RPG IV), CGILIB, the RPG Toolbox, and other commercial Web-enabled packages. Even with the changes, it retains a great deal of backward compatibility, so an RPG program written 37 years ago could run today with little or no modification. The SQL precompiler allows current RPG developers to take advantage of IBM's cost-based SQE (SQL Query Engine). With the traditional F-Spec approach a developer had to identify a specific access path to a data set, now they can implement standard embedded SQL statements directly in the program. When compiled, the SQL precompiler transforms SQL statements into RPG statements which call the database manager programs that ultimately implement the query request. In 2006, OS/400 was renamed i5/OS to correspond with the new IBM System i5 branding initiative; the 5 was later dropped in favor of just System i. In March 2008 i5/OS was renamed IBM i as part of the Power Systems consolidation of System i and System p product lines. The new Power Systems also adopt more mainstream version numbers, substituting 6.1 for the twenty-year-old V1R1M0 notation. The latest release is now referred to as IBM i 7.3 and fully supports the RPG IV language, as well as many others. The RPG IV language is based on the EBCDIC character set, but also supports UTF-8, UTF-16 and many other character sets. The threadsafe aspects of the language are considered idiosyncratic by some as the compiler team has addressed threads by giving each thread its own static storage, rather than make the RPG run-time environment re-entrant. This has been noted to muddle the distinction between a thread and a process (making RPG IV threads a kind of hybrid between threads and processes). RPG Open AccessRPG Edition was launched in 2010 with the full name of Rational Open Access. Upon its launch, IBM i chief architect Steve Will described it as an "enhancement that's really an architectural change that opens RPG up to whole new uses, and it’s being brought to the community by IBM i, our friends in IBM Rational, and several ISVs who’ve been working with IBM to hit the ground running. The idea behind the new capability is to remove the necessity for all output from RPG programs to be forced into the limited 5250 data stream. Instead, it can be passed to handlers, which can transform it in any way the handler wants. Wrap it in XML; put it in the format required by a pervasive device; make a Web page that doesn’t look like a 5250 screen; whatever you want."[9] While many companies were skeptical about the usefulness of Open Access, it gained immediate acceptance from some others, including Profound Logic corporation, which rapidly incorporated it into their products aimed at opening the i, and hired Scott Klement, a product developer well known for creating open-source tools to access the technology.[10][11] Data typesRPG supports the following data types. Note:
Example codeThe following program receives a customer number as an input parameter and returns the name and address as output parameters. This is the most primitive version of RPG IV syntax. The same program is shown later with gradually more modern versions of the syntax and gradually more relaxed rules. * Historically RPG was columnar in nature, though free-formatting * was 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 F ARMstF1 IF E K Disk Rename(ARMST:RARMST) * "D" specs are used to define variables D pCusNo S 6p D pName S 30a D pAddr1 S 30a D pAddr2 S 30a D pCity S 25a D pState S 2a D pZip S 10a * "C" (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" originally stood for "last record" * LR flags the program and its dataspace as removable from memory C eval *InLR = *On The same program using free calculations available starting in V5R1: * "F" (file) specs define files and other i/o devices FARMstF1 IF E K Disk Rename(ARMST:RARMST) * "D" specs are used to define variables and parameters * The "prototype" 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" originally stood for "last record" // LR actually flags the program and its dataspace as removable from memory. *InLR = *On; /end-free Assume the ARMSTF1 example table was created using the following SQL Statement: The same program using free calculations and embedded SQL: * RPG IV no longer requires the use of the *INLR indicator to terminate a program. * by using the MAIN keyword on the "H" (Header) spec, and identifying the "main" or * entry procedure name, the program will begin and end normally without using the * decades-old RPG Cycle and instead a more "C like" begin and end logic. H MAIN(getCustInf) * "D" specs are used to define variables and parameters * The "prototype" for the program is in a separate file * allowing other programs to call it /copy cust_pr * The "procedure interface" describes the *ENTRY parameters P getCustInf B 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 exec sql select arName, arAddr1, arAdd2, arCity, arStte, arZip into :pName, :pAddr1, :pAddr2, :pCity, :pState, :pZip from ARMstF1 where arCNum = :pCusNo for fetch only fetch first 1 row only optimize for 1 row with CS; /end-free P GetCustInf E As of V7R1 of the operating system, the above program would not necessarily need the prototype in a separate file, so it could be completely written as: Lastly, if you apply the compiler PTFs related Technology Refresh 7 (TR7) to your 7.1 operating system, then the above program can be coded completely in free-form, as follows: PlatformsAs stated above, the RPG programming language originally was introduced by IBM for their proprietary 1401, /360, /3, /32, /34, /36, /38 AS/400 and System i systems. There have also been implementations for the Digital VAX, Sperry Univac BC/7, Univac system 80, Siemens BS2000, Burroughs B700, B1700, Hewlett Packard HP 3000, ICL 2900 series, Honeywell 6220 and 2020, Four-Phase IV/70 and IV/90 series, Singer System 10 and WANG VS, as well as miscellaneous compilers and runtime environments for Unix-based systems, such as Infinite36 (formerly Unibol 36)]), and PCs (Baby/400, Lattice-RPG). The latest platform to receive an RPG compiler is Windows .Net through the WINRPG compiler which was purchased by I-Net System Solutions in March 2013. This version contains extensions to RPG IV beyond that of the base IBM compiler. These extensions provide Microsoft Windows and .NET Framework hooks in the Native and System/36 environment, as well as the ability to port DB/2 files to Microsoft Access and Microsoft SQL Server databases via Open Database Connectivity (ODBC). RPG II applications are still supported under the IBM z/VSE and z/OS operating systems, HP MPE operating system on HP3000 and the OpenVMS operating system on VAX, Alpha, and Unisys MCP and now Windows Servers and Desktops under I-Net RPG. See also
References1. ^{{cite web|url=https://www.ibm.com/support/knowledgecenter?origURL=api/redirect/iadthelp/v7r0/index.jsp|title=IBM Knowledge Center - Home of IBM product documentation|website=Ibm.com|accessdate=26 March 2019}} 2. ^"...IBM 1401 and the Report Program Generator (RPG) contributed significantly to this success...", IBM 1401 Data Processing System / 1959 3. ^but it says 1965, rather than the 1959 mentioned here. 4. ^[https://www-304.ibm.com/support/docview.wss?uid=nas1f23d225573c211a186256a240067a3da "Generating Random Numbers in ILE RPG Using the CEERAN0 API"], IBM.com 5. ^"How did we miss RPG IV's Coming of Age?", ibmsystemsmag.com 6. ^{{cite web|title=Totally Free RPG|url=http://ibmsystemsmag.blogs.com/idevelop/2013/10/as-you-may-have-already-heard-there-was-a-major-technology-refresh-tr-announcement-yesterday-check-out-fellow-blogger-st.html|publisher=IBM Systems Magazine|access-date=8 March 2014|author=Paris, Jon|author2=Gantner, Susan}} 7. ^{{cite web|title=RPG/400 User's Guide|url=https://www.ibm.com/support/knowledgecenter/en/ssw_i5_54/books/c0918160.pdf|website=Ibm.com|access-date=6 August 2017}} 8. ^{{cite web|url=https://www.easy400.net/cgidev2/start|title=EASY400 CGIDEV2|website=Easy400.net|accessdate=26 March 2019}} 9. ^You and i: You and i 7.1. Ibmsystemsmag.blogs.com (2010-04-13). Retrieved on 2013-08-10. 10. ^{{cite web|last1=Smith|first1=Chris|title=Profound Logic Blasts the Myths Surrounding Rational Open Access: RPG Edition |url=http://www.mcpressonline.com/rpg/profound-logic-blasts-the-myths-surrounding-rational-open-access-rpg-edition.html|website=Mcpressonline.com|access-date=12 April 2016|date=16 May 2012}} 11. ^{{cite web|title=Scott Klement Joins Profound Logic Staff|url=http://www.itjungle.com/tfh/tfh071612-story08.html|website=Itjungle.com|access-date=12 April 2016|date=16 July 2012}} Further reading
| title=9PAC, Report Generator | url=http://hopl.murdoch.edu.au/showlanguage2.prx?exp=35 | year=2006 | publisher=History of Programming Languages (HOPL), Murdoch University, AU }}
| title=RPG, Report Program Generator | url=http://hopl.murdoch.edu.au/showlanguage2.prx?exp=207 | year=2006 | publisher=History of Programming Languages (HOPL), Murdoch University, AU }}
| title=Pulling data out of computers in the mid-twentieth and early twenty-first centuries | url=http://www.snee.com/bobdc.blog/2006/02/pulling_data_out_of_computers.html | last=DuCharme | first=Bob | date=2006-02-26 }}
| title=The Modern RPG IV Language | url=http://mc-store.com/5080.html | last=Cozzi | first=Robert | year=1996 }}
| first=Gary B. | last=Shelly | authorlink= | author2=Thomas J. Cashman | year=1977 | title=Introduction to Computer Programming RPG | location=Fullerton, California | publisher=Anaheim Publishing Company | isbn=0-88236-225-9 }} External links
| last = Smith | first = Brian R. | authorlink = | author2=Martin Barbeau | author3=Susan Gantner | author4=Jon Paris | author5=Zdravko Vincetic | author6=Vladimir Zupka | title = Who Knew You Could Do That with RPG IV? A Sorcerer’s Guide to System Access and More | work = | publisher = IBM International Technical Support Organization | date = April 25, 2000 | url = https://www.redbooks.ibm.com/redbooks/pdfs/sg245402.pdf | format = PDF | doi = | access-date = 2012-02-18 }} "This redbook is focused on RPG IV as a modern, thriving, and rich application development language for the 21st century."
| last = IBM | title = IBM 1401 RPG manual | url = http://www.bitsavers.org/pdf/ibm/1401/C24-3261-1_1401_diskRPG.pdf | year = 1964 | id = C24-3261-1 | format=PDF}}
| last = IBM | title = ILE RPG Programmer's Guide | url = http://publib.boulder.ibm.com/infocenter/iseries/v6r1m0/topic/rzasc/sc092507.pdf | year = 2008 | id = SC09-2507-07 | format=PDF}}
4 : Data-centric programming languages|Procedural programming languages|IBM software|Programming languages created in 1959 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
随便看 |
|
开放百科全书收录14589846条英语、德语、日语等多语种百科知识,基本涵盖了大多数领域的百科知识,是一部内容自由、开放的电子版国际百科全书。