Road to Java Goes Through RPG IV
[Editor’s Note: This article is part one of a three-part series on making the transition from RPG to Java in an AS/400 shop.]
You’re committed to the AS/400 and develop applications in RPG. It works fine for you, always has. But you’ve heard so much about Java being the future of AS/400 application development, if not the savior of the platform. In fact, nothing runs it better than the AS/400. So you want to see what Java can do for your green-screen RPG applications.
You’re not alone. At user conferences coast-to-coast, standing-room only crowds are packing conference rooms to find out just what Java is all about. But the transition from traditional RPG to Java doesn’t happen overnight. IBM has outlined five phases AS/400 shops should go through along the road to Java.
This article deals with Phase I – upgrading RPG III and CL to RPG IV and ILE CL.
Why upgrade to RPG IV? First of all, IBM is no longer investing in RPG III. For that matter, it only invests in RISC versions of RPG IV. Secondly, RPG IV, available since the V3R1 release of OS/400 four years ago, is a more modern application development environment.
“RPG IV is more modular,” says George Farr, VisualAge RPG and ILE RPG IV technical development manager. “You don’t have monolithic applications with lines and lines of code.”
Furthermore, RPG IV is ILE-enabled, meaning it can be integrated with applications written in other ILE (Integrated Language Environment) languages like C and COBOL . “You can mix RPG with other languages, it combines all the lines together,” says Farr. “You create something in RPG, C or COBOL and run it all from a single process.”
Farr says RPG IV has similarities to Java in language elements and syntax, though it doesn’t have any object-oriented features like encapsulation, polymorphism and inheritance. He explains that RPG IV has structured op codes that “compare directly” to loops and “if…select” functions in Java. Data types used by both languages are identical.
“If you move straight from RPG III to Java, the learning curve is a lot steeper,” he says. “If it’s 50 percent going from RPG IV to Java, it’s 80 percent going from RPG III to Java.” And even if you don’t intend to move from RPG to Java, you’ll still need to move to RPG IV to integrate Java into your system environment.
“If you’re going to have any interoperability between Java and RPG, have Java call RPG or RPG call Java, only RPG IV can provide that enablement,” Farr says.
“As we move forward, I really don’t think Java will ever replace RPG. RPG is here to stay. Even if we wanted to kill it, what on earth would we do with the millions of lines of RPG code that are out there? If you feel your existing applications don’t need Java, you can leave them the way they are. But you can enable Java to talk to RPG and RPG to talk to Java with RPG IV.”
The RPG tide is slowly turning toward RPG IV. Farr estimates that the percentage of RPG users on RPG IV was in the single digits in the first two years after RPG IV was released. He says it’s likely in the 40-50 percent range now.
“Once you move to RPG IV, you should invest in cleaning up your RPG code,” he says. “With RPG IV’s op codes, you can do things in a single line of code – like add a date/time stamp – that you would have to write lines of code for in RPG III. You move to RPG IV, you turn them into procedures.”
So transitioning to RPG IV won’t turn RPG developers into Java developers. But it’s an important first step. Farr cautions that the object-oriented nature of Java can be difficult to grasp for the RPG programmer.
“Java is an object-oriented language similar to C++. It’s not being pushed by companies but by the user community. Java is a very elegant language. It cleans up a lot of the mess of C++, with multiple inheritance, with pointers, with garbage collection. Java’s made it a lot faster to do object-oriented programming than C++. But any OO language is going to be hard to an RPG user.
“It’ll be easier to learn Java than C++. The language features will be easy to learn, but the OO features will be extremely hard. It may take people a couple of months just to learn what OO is all about.”
Farr says not every RPG programmer will need to learn Java. He suggests that most shops will be mixed RPG and Java. New hires will likely be the Java experts.
“I see Java as unavoidable especially with the Internet. Most companies will have to tune in to it at some point.” If you convert your RPG III applications to RPG IV, don’t leave your CL applications behind. They must be converted to ILE CL.
“If you have applications written in RPG III and you convert them to RPG IV, it’s not good enough if your CL is still in an OPM (original program module) environment,” says Jing Wang, senior software engineer at IBM’s Rochester, Minn. AS/400 development center. “RPG IV runs into a separate ILE action group. Sharing open files and commit control does not work that well with CL. You must migrate CL to ILE CL and make the whole application ILE.
“We’ve found out a lot of applications do share open files. Without moving to ILE CL, you can still make files shareable, but it’s not that smooth.”
Like RPG IV, ILE CL is a must for interfacing with Java applications. Aside from being another step along the road to Java, ILE CL offers performance benefits as well.
“When an RPG program executes an external call, performance wise, it’s not as good with CL,” Wang says. “When you move CL to ILE and combine that CL module with the [ILE] RPG module to form a single program object, performance wise, it’ll be better than anything you had before.”
[Editor’s Note: Part two of the Road to Java series, due to run in the Jan. 11, 1999 MIDRANGE Systems, will focus on making the transition to modular ILE application development.]