rpg and java, the perfect marriage · 2014-09-17 · 20 toronto users group for midrange systems -...

7
20 TORONTO USERS GROUP for Midrange Systems - March, 2001 RPG and Java, RPG and Java, RPG and Java, RPG and Java, RPG and Java, The Perfect Marriage The Perfect Marriage The Perfect Marriage The Perfect Marriage The Perfect Marriage By George Farr Introduction A s I go around the country and the world talking to AS/400 RPG IV and COBOL programmers, I consistently get the same message. People are nervous and worried about the future of the AS/400 and in particular RPG. Here are some of the most common questions I get from you, our AS/400 customers: “Is RPG IV here to stay, or is IBM trying to kill it?” “V4R5 does not have any RPG IV enhancements, is that a signal from IBM that no more enhancements are planned for RPG?” “Is IBM turning the AS/400 into a Java machine to replace RPG?” “Is Java the only option for writing e-Business applications on the AS/400?” These are but a few of the questions AS/400 programmers keep asking. Let me address them here in this article. Yes, Java is a great new language that works very well for e-Business applications and incorporates many great technologies. However, RPG is still the workhorse of the AS/400 that many businesses are happily and successfully working with. IBM is not trying to “kill RPG” or ceasing investment in RPG. Neither should you, unless you see a very clear business reason to jump completely to Java (if multiple platform support is required, for example). RPG is the robust, productive and efficient business language that brought the AS/ 400 to where it is today. Our strategy at IBM is to enable each language do what it is best at, and enable you to mix and match the usage of each language in the context most appropriate for it. RPG is a great business language that works well and integrates well with the AS/400. Java is a good e-Business language for extending a business application to the Internet, a good object oriented language and a good multi-platform language. Making these two languages co-exist and easily integrate is our main goal. The real power of e-business for existing AS/400 customers will only be fully realized with the successful marriage of these two great languages, which will require using Java to connect Web and GUI user interfaces to RPG IV based business logic. Now back to the questions at hand, instead of answering these questions upfront and making your life easy, I would like to answer them by giving you a sneak preview of what’s coming in RPG IV in the next release. My intent is to wet your appetite on the new functionality that is planned for RPG IV as well as have you answer some of the above questions yourself. RPG IV prior to V4R5! Before discussing what’s coming in the next release of RPG IV (i.e. in Version 5 release 1) Let’s look back at the enhancements and investment that IBM have done over the years since the inception of RPG IV.In V3R1 we had seen

Upload: others

Post on 14-Mar-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: RPG and Java, The Perfect Marriage · 2014-09-17 · 20 TORONTO USERS GROUP for Midrange Systems - March, 2001 RPG and Java, The Perfect Marriage By George Farr Introduction A s I

20 TORONTO USERS GROUP for Midrange Systems - March, 2001

RPG and Java,RPG and Java,RPG and Java,RPG and Java,RPG and Java,The Perfect MarriageThe Perfect MarriageThe Perfect MarriageThe Perfect MarriageThe Perfect Marriage

By George FarrIntroduction

As I go around the country and theworld talking to AS/400 RPG IVand COBOL programmers, I

consistently get the same message.People are nervous and worried about thefuture of the AS/400 and in particularRPG. Here are some of the most commonquestions I get from you, our AS/400customers: “Is RPG IV here to stay, or isIBM trying to kill it?” “V4R5 does nothave any RPG IV enhancements, is that asignal from IBM that no moreenhancements are planned for RPG?” “IsIBM turning the AS/400 into a Javamachine to replace RPG?” “Is Java theonly option for writing e-Businessapplications on the AS/400?” These arebut a few of the questions AS/400programmers keep asking. Let me addressthem here in this article.

Yes, Java is a great new language thatworks very well for e-Businessapplications and incorporates many greattechnologies. However, RPG is still theworkhorse of the AS/400 that manybusinesses are happily and successfullyworking with. IBM is not trying to “killRPG” or ceasing investment in RPG.Neither should you, unless you see avery clear business reason to jumpcompletely to Java (if multiple platformsupport is required, for example). RPG isthe robust, productive and efficientbusiness language that brought the AS/400 to where it is today. Our strategy atIBM is to enable each language do what

it is best at, and enable you to mix andmatch the usage of each language in thecontext most appropriate for it. RPG is agreat business language that works welland integrates well with the AS/400. Javais a good e-Business language forextending a business application to theInternet, a good object oriented languageand a good multi-platform language.Making these two languages co-exist andeasily integrate is our main goal.

The real power of e-business for existingAS/400 customers will only be fullyrealized with the successful marriage ofthese two great languages, which willrequire using Java to connect Web andGUI user interfaces to RPG IV basedbusiness logic.

Now back to the questions at hand,instead of answering these questionsupfront and making your life easy, I wouldlike to answer them by giving you a sneakpreview of what’s coming in RPG IV inthe next release. My intent is to wet yourappetite on the new functionality that isplanned for RPG IV as well as have youanswer some of the above questionsyourself.

RPG IV prior to V4R5!Before discussing what’s coming in thenext release of RPG IV (i.e. in Version 5release 1) Let’s look back at theenhancements and investment that IBMhave done over the years since theinception of RPG IV.In V3R1 we had seen

Page 2: RPG and Java, The Perfect Marriage · 2014-09-17 · 20 TORONTO USERS GROUP for Midrange Systems - March, 2001 RPG and Java, The Perfect Marriage By George Farr Introduction A s I

21TORONTO USERS GROUP for Midrange Systems - March, 2001

the biggest enhancements ever done toRPG IV. The compiler had been totallyrestructured and rewritten to introducethe new language definition. Then cameV3R2/V3R6, which introduced two majornew enhancements. The first was“Procedures” and the second was signedand unsigned Integer data type. On cameV3R7 where many more enhancementswere incorporated into the language,these included:• Floating point data type• Conditional compilation and pointer

arithmetic• New built-In functions• Long Names and Null field support

To continue the tradition of moreenhancements to RPG IV, we introducedthe following in V4R2:• New indicator Data type• Varying length character fields• Compiler options on the H

Specification

At this point as we were planning theV4R4 release (We skip shipped V4R3),Java was gaining more and morepopularity and momentum in the industry.So, we turned focus a bit to making surethat Java and RPG interoperate welltogether.

First of all, since Java is a threadedlanguage and RPG is not, we made surethat RPG IV is thread safe and thereforeJava can call RPG without any potentialproblems. Next, we looked at all the datatypes that Java has and we made sure thatRPG IV is compatible with that. The onlymissing data type was 1 and 8 byteintegers and UCS-2 (Unicode). So weadded that support in V4R4.

Finally, we did not want to stop thetradition of more enhancements to RPGIV, and so we brought to you thefollowing enhancements:• New opcodes:EVALR, LEAVESR and

Free form FOR loop• OVERLAY(*NEXT)• More built in functions

And on we marched forward beyondV4R4…

RPG IV V4R5 andbeyond!The latest release of OS/400 is V4R5, which cameout in August 2000. Thisrelease of the operatingsystem, while significant inother respects, is not anapplication development(AD) release. All ADsoftware including allcompilers and tools, werenot updated. In IBMparlance, this was a “skipship” for us. This allows us toconcentrate on the next release, whichyou will see is very significant to AD. Infact, it will be the single most significantrelease for AD software since at leastV3R1, and perhaps ever for the AS/400.

You may have heard about some of theother major changes and enhancementscoming in the areas of WebSphere toolingand compiler and tool packaging(www.ibm.com/software/ad/as400).However you may not have heard whatthe plans are for RPG IV in the V5R1release coming in first half 2000. The goodnews is, RPG IV will enjoy its biggestrelease ever!

The following is a subset of theenhancements that you may expect to seein that release.• New built in functions such as:

%CHECKR, %XLATE, %LOOKUP,%SCANR, and many more

• MONITOR Operation group• Free Form Calculation Specification• Runtime control of file open• ELSEIF Operation code• Qualified names in data structures• Increased Java related support

The rest of this article willdiscuss some of theseenhancements and giveyou some examples toillustrate the function. Iwould like your feedback onthese and otherenhancements you wouldlike to see happen to RPG IV.If you would like tocontribute, please contactme. I am discussing this outin the open to make surethat IBM is doing exactlywhat you need to run your

business with. Obviously, all what isabout to be discussed here is still in adesign and implementation phase, sosome aspects may end up being changed,removed, deferred or totally replacedbefore the release is finalized.

Also, before I de-scribe these en-hancements, pleaseremember the ques-tions I discussed ear-lier in this article. I ampositive that they willbe all answered inyour own mind bythe time you haveread this article. En-joy!

New built in functionsSince we introduced built-in functions,(or BIFs for short) in the first release ofRPG IV, they became very popular withRPG programmers for their simplicity andease of use. Over the last many releaseswe have introduced BIFs in many areas.One of the main advantages of BIFs is

C* col.18 28 33 43C* | | | |C* Factor 1 op-code Factor 2 Result fieldC* Occurrence Value OCCUR Data Structure Occurance ValueC*C 6 OCCUR DataStruct1

Figure 1

George Farr

Page 3: RPG and Java, The Perfect Marriage · 2014-09-17 · 20 TORONTO USERS GROUP for Midrange Systems - March, 2001 RPG and Java, The Perfect Marriage By George Farr Introduction A s I

22 TORONTO USERS GROUP for Midrange Systems - March, 2001

the ability to use them in free formexpressions. In V5R1 expect to see manymore new BIFs that provide functionalitywithin free form expressions that waspreviously available only in fixed formcalculation specifications.

For example, take the OCCUR operationcode. Currently the fixed format of theopcode is as shown in Figure 1. Factor 1contains the numeric value to be used toset the occurrence of the data structurespecified in factor 2. The result field isoptional and if it is specified, it will beassigned the value of the multi-occurringdata structure specified in factor 2. Ourexample above is showing how we set theoccurrence of the multi occurring datastructure, “DataStruct1” to 6. The newformat for a BIF to represent the OCCURopcode will be as shown in the examplein Figure 2.

As you see in the example, we start byspecifying the %OCCUR BIF on the lefthand side of the EVAL operation code tocause it to change the current occurrenceof “DataStruct1” to 10. The second EVALoperation above causes the %OCCURBIF to return the current occurrence num-ber of the specified data structure. In ourcase above the value returned will be 10.

This is just one example of an existingoperation code that can be used in itsfixed format style and also as a BIF in amiddle of an expression. I won’t cover allof the BIFs here, but hopefully you canappreciate their ease-of-use value. Ourintention is to enable ever more free-formcapability into the language, while stillretaining the fixed-form heritage to giveyou time to evolve your coding style.Ultimately, this means every fixed formatopcode will support a BIF alternative.

MONITOR Operation GroupAs you know, in RPG there are two waysthat programs can handle exceptions:• Using the famous error indicator or

‘E’ Extender that allows the handlingof pre-defined set of exceptions.

• Using the ‘Program ErrorSubroutine’ (*PSSR) or File errorsubroutine (INFSR).

These two methods serve their purposewell. However, when an error occurs anda branch is done to an error subroutine,

there is no way to return to the nextinstruction short of coding a label and aGOTO to it (assuming the programmerknows where the exception occurred). Toenable more control of exception handlingin RPG IV, the MONITOR operation code(Or group) is added. It consist of thefollowing:• A MONITOR block,• One or more ON-ERROR blocks• An ENDMON operation(Or END op-

code)

The MONITOR block has the code thatis to be monitored for. In the exampleshown in Figure 3, you see the READoperation code being placed in theMonitor group. The On-Error blocks testfor certain status codes or a range ofstatus codes. If any one test evaluatesto true (an exception does occur), the On-Error block is executed and the error ishandled programmatically. If you haveused Java, this may look familiar to you!This structure is similar to the try andcatch clause in Java. Of course, it is also

similar in functionality to theMONMSG statement in CL.

Free Form CalculationSpecificationRPG has historically been a fixedformat language, with informationentering in explicit column ranges.Over time, however, RPG IV has beenevolving and introducing ever morefree format syntax. For example, theC spec now supports eight opcodes

that use an extended factor 2 in whichfree-form expressions can be coded usingnatural operators such as “=” forassignment and all the usual math andlogical operators. As well, theseexpressions allow the use of built-infunctions in place of field names, andeven calls to user-defined functions(procedures). Further, with the V4R2introduction of feedback built-infunctions such as %ERROR and %EOF,you can even avoid using resulting

*. 1 .. + .. 2 .. + .. 3 .. + .. 4 .. + .. 5 .. + .. 6 *C*C EVAL %OCCUR(DataStruct1) = 10C EVAL OCC = %OCCUR(DataStruct1)C* OCC = 10

Figure 2

To this end, listed below are some otherBIFs that you may expect to see in thenext release:

• %ALLOC• %CHECK• %CHECKR• %DAYS• %DIFF• %HOURS• %HOURS• %LOOKUPxx• %LOOKUPxx• %MINUTES• %MONTHS• %MSECONDS

• %MSECONDS• %REALLOC• %REALLOC• %SECONDS• %SHTDN• %SQRT• %SQRT• %TLOOKUPxx• %XLATE• %YEARS• %YEARS

JAVA RPG

Page 4: RPG and Java, The Perfect Marriage · 2014-09-17 · 20 TORONTO USERS GROUP for Midrange Systems - March, 2001 RPG and Java, The Perfect Marriage By George Farr Introduction A s I

23TORONTO USERS GROUP for Midrange Systems - March, 2001

indicators, and hence resulting indicatorcolumns. The introduction of theMONITOR statement in V5R1 continuesthis evolution.

In other specifications such as theDefinition and File you also see partiallyfree form specs, with the use of a free formkeyword area in columns 44 to 80. Indeed,the H spec is totally free form allowingkeywords anywhere in columns 8 though80.

Over the past years, as programmers usedthe free format parts of RPG IV, they gotto see the benefit of it and based oninformal polling we constantly do, mosthave grown to like it. It is, arguably, easierto code, easier to read, and easier to teachto new programmers. By continuing tosupport the fixed format heritage of RPG,we allow to move to this new style at yourown pace, and even on a programmer byprogrammer basis.

As a natural next step in that evolution,we are introducing in this release a totalfree form C Specification as you see it inthe Figure 4. The way it will work is asfollows: The free form calculationSpecification (or CF as you see it in theexample) is totally free format variation ofthe fixed form. An valid expression canbe specified anywhere from column 8 to80. Of course, the traditional fixed-formC-spec will continue to be supported.

As you see from the example, it is easierto read and indent your code in the freeformat version. As you may very wellexpect, there are few rules, (like

everything else in life,) that you need tofollow. For example, the first thing thatmust be coded after CF is the actualopcode. The compiler will expect this.Each opcode has a new free-formatsyntax that takes its operands on theright. Even though we tried to support allop-codes, in some cases we could not.For example, op-codes that require

resulting indicators are not allowed.However, some opcodes that wecould not support already haveexisting built-in functions

(example: %SUBST), and for others,there are new built-in functions(example: %LOOKUP).

Runtime Control of FileOpenToday to control the exact file to beopened, RPG programmers have toissue an override command in a CLprogram or have to call QCMDEXCfrom their RPG program. Have youever wanted to open a file at runtime

dynamically without calling a CL programto do the override? In a world where RPGlogic might be called directly from a Webor GUI client, this becomes moreimportant. We offer help in V5R1. Withthe introduction of two new keywords,namely, EXTFILE and EXTMBR this taskis made a lot easier for you.

C MONITORC READ MASTERC IFNOT%EOFC* DO SomethingC ENDIFC On-Error 1211:1011C* Handle “closed file” error andC* “unknown record format” errorC On–Error *FILEC* Handle other file errorsC On–Error *PGMC* Handle errors processing fieldsC ENDMON

Figure 3

Page 5: RPG and Java, The Perfect Marriage · 2014-09-17 · 20 TORONTO USERS GROUP for Midrange Systems - March, 2001 RPG and Java, The Perfect Marriage By George Farr Introduction A s I

24 TORONTO USERS GROUP for Midrange Systems - March, 2001

The parameters to these new keywordscan be constants, but better yet, they canbe variable names to indicate the file nameand the member name respectively to beopened.

Lets see how this all work by looking atthe example in Figure 5. Here the first FSpecification declares the file “MyFile”and initializes it to “FARR/MASTER” aspart of the EXTFILE parameter. TheEXTMBR keyword indicates that allmembers will be opened when an OPENon the file “MyFile” is executed. So, inthe C Specification when we actuallyopen the file “MyFile”, the actual fileused will be all the members in file “FARR/MASTER”.

On the other hand, the second file wedeclare uses a field name as a parameterfor the EXTFILE keyword. This as yousee in the code will enable us to initializethe field to whatever file we want to openat run time and then explicitly open it.Great, huh! What if we have overrides ineffect, you may ask! Well, first of all you

do ask great questions! Say, we have thefollowing override in effect before callingour RPG program:

OVRDBF PRODUCTION FARR/INVENTORY

This will change what gets opened whenwe execute the statement “OPENYourFile”. Since the field “YourFile”contains the value “FARR/PRODUCTION” and sincePRODUCTION had an override in effect,the actual file that gets opened is “FARR/INVENTORY”.

ELSEIF operation codeThe opcode name gives it away, no needto explain it further! Well, in Figure 6, weshow a little program fragment that usesthe ELSEIF opcode. As you see in theexample, the ELSEIF opcode is acombination of the IF and the ELSE op-codes. This opcode eliminates the needfor a new nesting level and hence a newEND-IF statement.

For small structures, the ELSEIFoperation makes the code a lot easier tomaintain and read. Of course, you can stilluse the traditional ELSE and IFstatements and the SELECT/WHEN/OTHER combinations as usual. There isno performance benefit using one overthe other, so it is your call.

Qualified Names in DataStructuresDid you ever wonder why in RPG you arenot allowed to declare same names ofData Structure subfields in multiple DataStructures? We are sure you alwayswondered why other high level languagesallow it and RPG doesn’t! Wait no longer!The next release of RPG IV will have“Qualified names” supported.

What does that mean? Well, a newkeyword, QUALIFIED, will be added toindicate that Data Structure subfieldnames must be qualified by the “parent”data structure name when used anywherein the program. The way you wouldreference a subfield in a qualified datastructure is as follows:

ParentDS.ChildSubField

In addition, we are adding anotherkeyword, LIKEDS, to allow you to definea Data Structure to be the same as anotherone in your program. Lets take a look atan example of how this would end upworking out. The example in Figure 7shows three data structures, Customer,Supplier, SecondSupplier. All datastructures have subfields with identicalnames, namely: Name and Address. Asyou see in the code we use the qualifieddata structure name format to initialize alldata structures. Also note that“SecondSupplier” data structure isidentical to “Supplier”. Couldn’t besimpler! Hope you like it! You arewelcome!

Increased Java relatedsupportAs we close on V4R4, we can all be veryproud at the “water cooler” when we talkto other programmers about RPG DataTypes.

FMyFile IF F 10 DISK EXTFILE(‘FARR/MASTER’)F EXTMBR(‘*ALL’)Fproduct IF F 10 DISK EXTFILE(YourFile)F EXTMBR(‘*ALL’)C*C OPEN MyFileC* ————————————————————————————C EVAL YourFile = ‘FARR/PRODUCTION’C OPEN YourFile

Figure 5

CF read fileCF dow not %eof(file)CF if %errorCF dsply ‘Error occurred’CF leaveCF elseCF chain:n name database dataCF EVAL time = hours *num_employees + overtimeCF*CF* *****DO SOMETHING******CF*CF endifCF enddo

Figure 4

Page 6: RPG and Java, The Perfect Marriage · 2014-09-17 · 20 TORONTO USERS GROUP for Midrange Systems - March, 2001 RPG and Java, The Perfect Marriage By George Farr Introduction A s I

25TORONTO USERS GROUP for Midrange Systems - March, 2001

As an RPG programmer, you can lift yourhead up and proudly say that RPG hasas many, if not more data types than Javadoes.

In addition, we wanted to continue ourstrategy of making RPG IV and Javainteroperate well together. After all, thefuture is a mix of Java with RPG. Thisrelease is another one that will see a greatJava related enhancement to RPG. Thatis to introduce an easy way, other thanJNI, to call a Java class from an RPGprogram using RPG syntax. Why nothave RPG IV call a Java class and invokea Java method by simply doing a CALLP?Well, watch what you say because yourwish might just come true in V5R1. Thisenhancement to RPG prototypes willenable programmers to indicate thatprocedures are actually Java methods! Inturn, when a call is made using theseprototypes, the compiler will internallygenerate call to the JNI. (We call it internalplumbing that RPG programmers shouldnot worry about.)

The prototypes will also enable RPG tohandle parameters correctly according toJava conventions. After all, RPG at thispoint has absolutely all data types thatJava has. So life is easier now to mix bothlanguages.

As always, the easiest way to explain thisenhancement is by giving you smallexample.

CF IF Day = ‘Monday’CF CALLP MondayRoutineCF ELSEIF Day = ‘Tuesday’ or Day = ‘Wednesday’CF CALLP MidWeekCF ELSEIF Day = ‘Thursday’ or Day = ‘Friday’CF CALLP EndWeekCF ELSECF CALLP WeekEndCF ENDIF

Figure 6

The Figure 8 illustrates this...

As you see in the example we first declarethe method to be used, in this case the“add” method in the“java.math.BigDecimal” package. Thenext line declares the constructor for thatclass. Think of the constructor as your*INZSR subroutine that is called at thestart of initialization. We declare threeadditional Objects of type“java.math.BigDecimal”. These all are oftype “O”, your guessed it, “O” stands forthe newly introduced type of Objects inRPG. The first 2 EVAL statements call theconstructor methods to create thenumeric values with the specified initialvalues. The last EVAL calls the addmethod in the BigDecimal class to do theactual addition. If you are not familiar withJava this may seem complicated.

However, believe it or not this is as simpleas it gets to have RPG call Java. However,if this syntax looks a little daunting, lookfor a wizard inside the CODE/400 editorto generate it for you after you pick theclass and the method you wish to call.

Why All This?In this rapidly changing world, I believethere is a strong continued role for RPGas a business logic language. However,to continue to realize that role, RPG hasto evolve to accommodate newtechnologies such as Java. It also has toevolve to be ever more productive tocode and maintain, and it has to evolveso it is appealing to the new generationsof programmers while not abandoning theexisting generations.

*. 1 .. + .. 2 .. + .. 3 .. + .. 4 .. + .. 5 .. + .. 6 *D Customer DS QualifiedD Name 20AD Address 50AD Supplier DS QualifiedD Name 20AD Address 50AD SecondSupplier DS LIKEDS(Supplier)D*——————————————————————————————————C*C Eval Customer.Name = ‘Barbara Morris’C Eval Customer.Address = ‘ 2 Myway Drive’C Eval Supplier.Name =’Hans Boldt’C Eval Supplier.Address=’1 MyWayTheBestWay Blvd’C Eval SecondSupplier.Name =’George Farr’C Eval SecondSupplier.Address=’3 ThisIsTheWay Ave’

Figure 7

Page 7: RPG and Java, The Perfect Marriage · 2014-09-17 · 20 TORONTO USERS GROUP for Midrange Systems - March, 2001 RPG and Java, The Perfect Marriage By George Farr Introduction A s I

26 TORONTO USERS GROUP for Midrange Systems - March, 2001

In an e-Business role, it has to have lessdependency on CL, and more flexibilityto work in a world where snippets of codeare called to do a fine-grained job, versusa large monolithic process. Last but notleast, it has to continue to address yourrequirements and wish-list items whichyou continue to feed us each release. Itis our hope that we on such a path withthe enhancements RPG IV has enjoyed sofar and which are coming in the next andsubsequent releases.

Thank you is in order!My Hat is off to my great RPG team, leadby Barbara Morris and Hans Boldt whocontributed a great deal to making thisrelease and many previous releaseshappen for RPG IV. I am sure Hans andBarbara will start giving you more of thedetails on these enhancements by writingadditional articles if you all “Behaveyourselves!” So, watch out for more!

Final words…If you like what you see so far, then tellyour parents, friends, co-workers,cousins, in laws, and neighbors about it!If you don’t, I suggest you remain silentand nothing will be held against you!

Kidding aside, I believe that RPG IV is,as always, the best business languagethat integrates very well with the iSeriesand AS/400. It’s proven year over yearto be an excellent business language anda workhorse that had many successfulbusinesses rely on it and succeed. IBMis not about to let that go.

In addition, with the Internet and e-Business we have a new form of businessapplications that are forming shape. Javahas been proven to be the glue languagefor the Internet and e-Business. For thoseready, willing and able to make the jump,it has also become a proficient languagefor business logic as well. With theintroduction and maturation of Enterprise

Java Beans, this is even more true. IBMis betting heavily on Java. But restassured, IBM also continues to betheavily on RPG. You can be guaranteedthat our Application Developmentstrategy on the iSeries will be built towardthe success and integration of both Javaand RPG IV combined together. I believethat this upcoming release of RPG IV isthe biggest release ever since theinception of RPG! I do hope that youagree with me after giving you this sneakpreview of what you might expect to seecoming to an AS/400 near you in V5R1T G

George Farr works at the IBM Torontolaboratory, as the technicaldevelopment manager for the RPG andVisualAge for RPG languages. Georgeis a frequent speaker at COMMON andother conferences and user groupsworldwide. He is also involved ineducation for RPG IV, Java, andVisualAge at IBM. George recently co-authored (with Phil Coulthard), thebooks Java for RPG Programmersand Java for Cobol Programmers.You can reach George [email protected].

*. 1 .. + .. 2 .. + .. 3 .. + .. 4 .. + .. 5 .. + .. 6 .. + .. 7 .. + .. 8 *D BigDecimal C ‘java.math.BigDecimal’D add PR O EXTPROC(*Java: BigDecimal: ‘add’)D otherNum O CLASS(*Java: BigDecimal)D CONSTD ConstructNum PR O EXTPROC(*Java: BigDecimal: *CONSTRUCTOR)D GetValue PR O EXTPROC(*Java: BigDecimal: ‘toString’)D CLASS(*Java: ‘java.lang.String’)D getLongValue PR 20I 0 EXTPROC(*Java: ‘java.lang.Long’: ‘valueOf’)D STATICD string O CLASS(*Java:’java.lang.String’)D CONSTD Num1 S O CLASS(*Java:BigDecimal)D Num2 S O CLASS(*Java:BigDecimal)D Total S O CLASS(*Java:BigDecimal)D longInteger S 20I 0D*———————————————————————————————————————C EVAL Num1 = ConstNum(225)C EVAL Num2 = ConstNum(175)C EVAL total = add(Num1: Num2)C EVAL longInteger = getLongValue (GetValue (total))

Figure 8