Rpg iv programming fundamentals workshop for ibm i duration. We will start by showing how a simple subroutine can be converted to a subprocedure. Bob cozzi is a programmerconsultant, writerauthor, and software developer of the rpg xtools, a popular addon subprocedure library for rpg iv. Rpg lesson 4 adding a loop, if and subroutine to the rpg iv. This course covers both fixed format and free format, with the most modern language enhancements. Apr 03, 2015 a procedure is a routine that is called using a bound call. Handling of directives by the rpg preprocessor 20 chapter 3. Binding the two rpg functions into a single program. This class is not designed for rpg iii programmers who want to learn rpg iv. You only need a pi for input entry plist parameters, not when calling something else. For a description of the job date, see thework management manual. Rpg iv has eliminated virtually all the limitations of previous versions of rpg.
This is the first in a series of three courses in the ibm i curriculum for programmers who are new to rpg iv. Ucasecan be used when the desired output is required to be in all uppercase letters. Ibm has created many builtin functions to provide functionality equivalent to or better than most of the missing operation codes. This new edition of the modern rpg iv language is packed with new information including new, neverbefore published information on coding freeformat rpg iv. Sep 16, 2010 rpg iii adding a loop, if and subroutine to the rpg iv program in the previous topic, we added a do loop to read all records in the file, an if statement to test the state for tn and a subroutine.
Rpg iv goals for the language three main goals for rpg iv interoperability java xml. We converted all of our rpg iii code to rpg iv about 10 years ago. Its harder to read the code when the source constantly jumps in and out of free form. The moving from rpg 400 to i5 iseries rpg iv class oe85s6126 is designed to satisfy this need, when it is available in your geography. Connector lines are also drawn between the beginning and ending of control structures. In 2001, with the release of os400 v5r1, rpg iv offered greater freedom for calculations than offered by the extended factor2 calculation specification. After completing the courses in this series, the users will be able to write rpg iv programs using structured design and modular programming concepts.
The calclevel subroutine calculates the indention level of the statements, based on the structured operation codes used in the source member. Say goodbye to old rpg subroutines, and get to know ile rpg s powerful subprocedures by david shirey editors note. This elearning computer training series includes all of the online training tutorials listed below and is provided in an interactive elearning format. This course teaches the basics of the ibm i rpg iv programming language. In case of load all subfile, if we type options and then pgdn,pgup, will options be there on the display. Subroutines, which can be called from mainline calculations or subprocedures, should be used to reduce redundant coding within a procedure. Structured programming and subroutines printing from an rpg iv program.
This course is a comprehensive exposure to the basic features and functions of rpg iv for version 7. Outputminintvalue1, intvalue2 invoking a subroutine can also occur without parameters. Rpgiv template documentation users guide version 2. See the essential rationale for 10 reasons you should favor freeformat rpg. You should be beginning to sense that rpg iii is powerful but ugly. To help you transition from fixedformat rpg iv coding to free format this guide will cover freeformat mechanics, best practices, and conversion tips. The subroutine writes two records to a log file with different data, depending on different events. A great enhancement was presen ted by announcing rpg iv, since it has contained a new function type beside subroutines called. Examples of other programming languages are basic, cobol or rpg ii. External subroutines calling assembler from rpg although the extensions to rpg syntax that came with rpg ii and rpg iii and undoubtedly rpg iv as well remove any barriers that prevent rpg programs from completing any task that can be achieved with any other programming language, the original rpg does have some shortcomings. Also, note that the concepts weve talked about so far are not exclusive to rpg.
The ddsthe same as it ever was before i get to the rpg, i need to say a few things about the dds and cl. The as400 rpg compiler has a builtin conversion tool. A specific subroutine that is to be run at program initialization time can be defined by specifying inzsr in factor 1 of the subroutines begsr operation. Chapter 5 subroutines and functions invoking a subroutine a subroutine is used when a series of steps are required but no value is returned to the routine that called the subroutine. Refer to figure 1 to see a detailed explanation of the rpg iv initialization subroutine. For this application to have the necessary flexibility, the rpg programand not os400must completely control the subfile. This manual is intended to help you with application programming. Part two may be attended by programmers with some experience of rpg iv who need to learn about more advanced features in rpg iv.
This suggests that this techniqueis best used only when the parameters are such that it is difficult to find an acceptable sequence by the conventional method. Linomas rpg toolbox c copyright 19962002, linoma software. Future proofing your rpg applications toronto users group. So, the development team began using rpg iv immediately for all new and rewritten programs.
Rpg iv indicators35 indicators defined on rpg iv specifications. This course is too basic for experienced rpg iii programmers. It is the first of two courses that should be attended in sequence. Refer to figure 1 to see a detailed explanation of the rpg iv initialization subroutine the initialization subroutine allows you to process calculation specifications before 1p output. Pdf applying and evaluating halsteads complexity metrics and. In the data structures subfields notice that the data type is n for a indicator type field on lines 57 and 1011. Rpg open a free open source service program with addon subprocedures written in rpg iv for rpg iv.
Rpg iv programming fundamentals workshop for ibm i ref. Chapter 12 delves into freeformat in detail as he discusses move alternatives, date and time conversions, data structures, and more. A specific subroutine that is to be run at program initialization time can be defined by specifying inzsr in factor 1 of the subroutine s begsr operation. A lot has changed since rpg iv was introduced, so come learn how to bring modern development tools. The modern rpg iv language,2003, isbn 1583470646, ean 1583470646, by cozzi b. A subroutine is a block of code inside a program, with an identifiable beginning and end. Today, freeformat calculations in rpg iv can look like any other modern programming language. Avoid using obsolete conditional operations statements in rpg subroutines rpg iv only rpg400 1008082. Based on positive feedback from our developers and wellknown experts in the rpg community, we are highly. Now that you have a good understanding of the language differences between rpg iii and rpg iv, as well as the conceptual differences between opm and ile, its time to cover the specifics of ile. This article is excerpted from chapter 7 of 21st century rpg. The report program generator rpg language was designed by ibm in the early 1960s for the primary purpose of cranking out batch reports. Dou sets up a future check but otherwise does nothing.
The focus is entirely on the latest of the rpg iv for version 7 compiler and the techniques that it provides. Included in these chapters are the language elements of fortran iv and the five categories of fortran iv statements arithmetic, control, inputoutput, specification, and. No previous knowledge of rpg is required or assumed. Subprocedures coding procedures within a program coding procedures in a separate modules passing parameters by referencevalue other prototyping options. Programming in rpg iv bryan meyers 20100801 recently revised and. Compiling rpg iv programs compile step binding step crtbndrpg command creating modules combining multiple modules introduction to subprocedures subroutines vs. It is the first of three courses that should be attended in sequence. Built in functions %div and %rem have been added to support integer. With rpg iv, ibm has added natural expressions, long field names, more data types, including native date and time data type fields, and subprocedures. Rpg iv is the only version of rpg supported by ibm in its long line of successors to the as400 system iseries, system i, etc.
A subroutine is used when a series of steps are required but no value is returned to the routine that called the subroutine. Aug 15, 20 in the rpgle rpg iv source member i add the indds keyword into the file specification for the display file, see below, and the data structure with the same name as was given in the indds. Oct 29, 2014 some of the advantages of using rpg procedures rather than subroutines subroutines versus subprocedures i was at a presentation given by partner400s susan gartner and jon paris where, amongst many things, they discussed replacing subroutines in your rpg code with subprocedures. Rpg iv is the only version of rpg supported by ibm in its long line of successors. Rpg iv programming fundamentals workshop for ibm i. A bakers dozen or so useful rpg iv tips from bob cozzi. Rpg iv programming fundamentals workshop for ibm i cursusduur.
A new environment that lets you write small routines and bind them all together to make. Modern rpg for the modern programmer december 2016 sg24540201. Java for s390 and as400 cobol programmers,1583470115 zit also contains information from the related student workbook. Rpg iv subprocedures use prototypes, which are a way of defining the. Rpgalive helps programmers analyze and program ile rpg rpg iv, rpg 400. In this session, we will concentrate on writing and using rpg iv subprocedures, but you will find that many of the same prototypewriting skills can be applied to access system apis and c functions. Migrating this to rpg iv syntax and yes it is technical rpg iv syntax already, but it is really an rpgiirpgiii structure is a matter of converting the fromto column notation to lengthnotation. It is an electronic file format regardless of the operating system platform. The controlling condition of the loop is usually set soon after the dou, and an if test is placed afterward to deter. Rpg ii for mvs, os390 and zos status of the ibm rpg ii product in zos. And we dont normally convert the rpg iv it to free form because of move and movel basically.
The boundaries of definition between a subprocedure and subroutine are not thick. General created new hltcmt command to allow highlighting just the comment lines in cmd, clp, clle, dspf, lf, pf, prtf, rpg, rpgle, rpt, sqlrpg and sqlrpgle member types. Subroutine return points the modern rpg iv language. Eigenvalues and variability of principal components subroutine level. I use subprocedures not subroutines to structure my code. With help of two opcode begsrbegin subroutine endsr end subroutine and between these two opcodes write the instruction. Rpg iv application developer evolution midrange news. But the real fun begins when you combine the features. You can use the infsr keyword subroutine on an f spec, the subroutine you name as a parameter will be invoked in the event of a file error. Call graph showing subroutine, procedure, and program calls. You do not need to code anything special to define the main procedure. Since that time, linoma has used the freeform syntax extensively for inhouse development.
The original style of programs is now called opm opm original program model. Code simply gets translated to its rpg iv equivalent. Subroutine is one of the major constructs rpg iv supports to deal with top down design and modular development. The new rpg compiler that has ile functions is based on the 4 th specification of the rpg language, aptly named rpg iv. Avoiding the green screen of death in rpg programs it jungle. In theory, th e endsr for a pssr subroutine can contain a returnpoint instruction, but most of them only apply if you are using the rpg cycle, and even then are of marginal to dubious utility. I worked for a software development house that wanted the ibm look and feel on all of its screens. This manual is intended to help you with application pro. Lets recreate this program using the easier to read syntax of rpg iv. Write simple rpg iv enquiry programs that interact with displays. Rpg400 uses a strict, columnbased format that is inherited in rpg iv, bu.
Subroutine is coded between begsr begin subroutine and endsr end subroutine operations. Additional builtin functions at that time also helped to modernize rpg iv s procedures. Program control flows immediately to the next operation after the dou. This tool performs only basic conversion of rpg iii to rpg iv, with no conversion to lowercase, no inclusion of eval statements, and so forth. Structured programming and subroutines printing from an rpg iv program accessing the db2 database using rpg iv using the debugger coding. Subroutinenameparameterlist invoking a subroutine can occur with parameters.
The thinking was that users familiar with the as400 would be comfortable using the interactive screens in our software and would require less training. Subroutines have been with the rpg language since its inception. O ile rpg for as400 programmers guide version 4 sc09250702. The rpg programmers guide to rpg iv and ile caribbean. In summary, some of the benefits offered by ile include. Pdf although rpg is an older programming language for developing general purpose. Pdf comparison of static analysis tools for quality. Net coach 5 chapter 5 subroutines and functions string functions function name. Rpg is a highlevel programming language for business applications, introduced in 1959 for.
In those cases, the rpg iii version will be in parenthesis next to the expanded. This course is not designed for rpg iii rpg 400 programmers who wish to develop rpg iv skills. The event code and key value are different for a customer change than for an item change, but the rest of the fields need to be intiialized and the record written. Rpg iv should use mixed case, or if you prefer, all lowercase letters for variable names. Introduction to ile rpg iv programming course summary description this class provides an introduction to rpg iv programming on the ibm i iseries and as400. It is also commonly used when you wish to validate data entered by a user against a.
Rpg iv programming fundamentals workshop for ibm i arrow. The effort and complexity converting from opm to ile can vary widely depending on how extensively you want to exploit iles features. You will pass the as400 rpg iv developer certification with the help of our 000267 as400 rpg iv developer practice dumps. Internal failure in rpg compiler or in runtime subroutines. Procedures may be written in any ile language and combined with procedures from other ile languages to form a single program. Rpg iv programming fundamentals workshop for ibm i as060. Steve baumann, who is also a technical development advisor with the series group, points out that moving to rpg iv does not require the use of rpg integrated language environment ile concepts and has many bene. Rational development studio for i ile rpg language reference 7. As400 rpg iv developer dump cram is a good and useful training tool for ibm 000267 exam preparation. International technical support organization who knew you could do that with rpg iv.
The initialization subroutine allows you to process calculation specifications before 1p output. Returns the stringthat is passed in all uppercase letters. Delimit subroutines and ile subprocedures rpg400, ile rpg illustration. His book the modern rpg language has been the most widely. Rpg, cobol and cl join the party in v3r1 may 1994 rpg s syntax is changed at the same time. After completing this course, the student should be able to. Cl, dds, and rpg that make this work at the end of this chapter. Rpg iv subprocedures use prototypes, which are a way of defining the interface to a called program or procedure.
1465 875 703 833 1666 1493 1703 1292 720 1315 1197 101 174 1476 380 154 682 613 1054 1265