Newsletters Subscriptions Media Kit About Us Contact Search Home

Stuff
OS/400 Edition
Volume 2, Number 14 -- July 17, 2003

IBM's Toolbox for Java Is Getting Better Every Day


by Joe Pluta

I really enjoy writing articles like this. That's because I get to share with you one of my favorite tools, the IBM Toolbox for Java. While the toolbox has undergone a number of changes over the years, it is still one of the most remarkable pieces of software you are ever likely to see. And it's free. And it's open-source!

That's right. Not only is it an incredibly powerful and robust set of tools that is growing every day, but IBM even makes the source available, so that you can dive in and see how the code works (not to mention getting a chance to see how some really brilliant Java programmers do things).

A Little History

So what is the toolbox? Well, it started its life back around 1998 as IBM's Java Toolbox for the AS/400. JT/400, as we called it, was quite an interesting little package. Of course, many of us figured it was just a curiosity because it was written in that strange upstart language, Java, and since Java was about browsers, who really cared? It's not like you'd ever access an AS/400 from a browser! Little did we know.

If you think about it today, that project showed a great deal of prescience on IBM's part. At the time, Java was barely three years old, and it really was all about browsers. The JDK (the compiler) was only two years old, and the first really usable version (1.1) had been released a little more than a year before. There was no real thick client; Swing was just being readied for release. J2EE was still two years from implementation. Yet IBM created and released what is to this day one of the most powerful Java packages ever developed--and one of the least known.

So What Is It?

Well, the toolbox, now simply known as IBM's Toolbox for Java in its Licensed Program Product (LPP) version and as JTOpen in its open-source guise, is a set of more than 2,000 classes designed to allow access to virtually every facet of the AS/400 or iSeries. By taking advantage of the host servers originally developed for Client Access, the toolbox has access to every feature of OS/400. You can read files, open print reports, send messages, call programs, and access system values--all with 100% Pure Java classes. Why is this important? Because it means that a program written using the toolbox can be run on any platform, from Windows to a Macintosh, without changes. Not to mention running natively on OS/400.

So what does it provide? The toolbox provides support for the following:

  • File access, including JDBC, record-level access, and data conversion
  • Integrated File System (IFS) access
  • Program calls (including PCML) and command calls
  • Printers, spool files, and output queues
  • Users, groups, jobs, and job logs
  • Messages, message queues, and message files
  • User spaces, data areas, data queues, system values, and system status

Java programs, on any platform, can access all of these objects. SSL is supported, too, so all communication is encrypted. In addition, for PC-based platforms, IBM provides a set of "visual access" classes, which provide GUI access to various resources on the AS/400.

Think about it. You can write a program in RPG that performs all kinds of complex database I/O. Just write it as a server program--pass in some parameters, like item number and date range, then return some other parameters, like YTD sales in dollars and units. Then you can write a Java program that calls this RPG program directly. And then you can run that application, on your PC. That's right. And when you run the application, it will automatically pop up a little prompt for system name, user ID, and password. Key in the appropriate information, and the application will run that RPG program on your server and return the results to you.

Sound like a plan? Or you can include that code in a servlet or a Java Bean, and incorporate the output into a JavaServer Page. Or you can write a Java program on your PC that reads a flat file and generates an Excel spreadsheet. Because you're using Java, there are hundreds of third-party and open-source JAR files out there that you can take advantage of. Next, you can map a drive to your PC using AS/400 NetServer. Finally, just copy the program to your iSeries IFS, and run it as a batch job at night. You can then even use your iSeries to e-mail the generated spreadsheet, using the JavaMail APIs. The possibilities are endless.

The Two Versions

As I mentioned, there are two versions of the toolbox, the LPP version that is shipped with OS/400 and the open-source version that you can download from IBM's JTOpen site.

Since OS/400 V5R1, the LPP version is located in /QIBM/ProdData/OS400/jt400/lib, in a JAR file called jt400Native.jar. This file has special native optimizations bundled in that will make OS/400 applications more efficient, but will only work when run on OS/400. For more information on the LPP version of the toolbox, go to the V5R2 Java Toolbox home page.

The other version is the open-source version, JTOpen. I happen to be a member of the JTOpen Core Team, and while I haven't been as involved with the team as I would like, they continue to produce great things without me, especially in the area of JDBC. While I'm not particularly fond of JDBC, the JDBC 2.0 specification makes it a much more viable alternative to native DB2 access, especially for Java-based applications. And the JTOpen team continues to lead the industry in support for these standards.

Why would you use one version rather than the other? While the two efforts really were quite separate, IBM has continued to embrace the JTOpen project as part of its core OS/400 offering, and today there is very little reason not to use JTOpen. JTOpen is basically a superset of the current LPP; changes are made first to JTOpen, then migrated back to the LPP, as time permits. However, if you want the latest functionality, especially in the JDBC arena, the JTOpen version is always a bit ahead of the LPP.

Of course, the JTOpen package is a little more aggressive, and occasionally a bug slips in that might not survive the LPP release process. But since JTOpen has been available, I have never heard a complaint about quality. And then there's the issue of source.

The JTOpen is probably one of the most ambitious open-source projects around. As I said, it comprises more than 2,000 classes, all of which are available in source format. You can rummage around, load them in your debugger, and even modify them to your own personal requirements. And I've always believed that there's no better way to learn a language than by seeing lots of examples of it being used in the real world, and JTOpen is definitely a ton of code. To find out more about JTOpen, go to the JTOpen home page.

Not Just for Now, but for the Future

I believe the toolbox, in either form, is crucially important to the future of our platform because it allows you to take advantage of the unique strengths of OS/400. In this age of antipathy toward "proprietary" systems, there is often a sense that anything unique about a platform is by definition bad. Well, this is certainly going to be the rallying cry for systems that don't have those features, and when you're talking about OS/400, there are quite a few features that other systems don't have.

And until the advent of the toolbox, you pretty much had to use an OS/400-specific language, like RPG, to take advantage of these features. This tended to lock you into a single platform, lending credence to the "proprietary" argument. Now, though, you can encapsulate any feature of OS/400 within a Java class, and provide that seamlessly to another Java application.

Say you needed the result of some complex business calculations on data in some DB2/400 files. You could program that logic quickly and efficiently in an RPG program and code your business object to call it using the Toolbox ProgramCall class. But let's say that in some environments the data resided in an SQL database with no RPG access. You could write your application to use SQL in either case, but that lowers OS/400 to the level of an SQL server. Or, with the toolbox, you could modify your business object to use SQL where appropriate and call an RPG program where available. Applications that call your class are none the wiser. And now you have an application that will seamlessly take advantage of the strengths of OS/400 whenever possible. This is a different philosophy than simply coding to the lowest common denominator, and will allow OS/400 to continue to play an important role in even the most open of application environments.

Oh yeah, and don't forget to check out the MPO index for articles by Kevin Vandever that show how to use the toolbox to call RPG programs and stored procedures, run commands, and access data queues.

Here's hoping you will take advantage of it!


Joe Pluta is the owner of Pluta Brothers Design and the author of Eclipse: Step by Step, the first tutorial guide to building business applications using IBM's new Eclipse platform. E-mail: joepluta@plutabrothers.com


Sponsored By
DAMON TECHNOLOGIES

The Next Evolution of RPG is Here!

RSP (RPG Server Pages) is the best way to develop Web applications with RPG.

  • Developers use their existing RPG skills.
  • More robust than CGI with greater flexibility.
  • RSP is not just visual development. It is an application server built specifically for the iSeries.
  • Full debug capabilities.
  • Session Handling with a built in garbage collector.
  • The most cost effective solution for the iSeries.

With RSP, Web content is developed with the Ease, Speed, and Reliability of RPG.

In today's fast paced business world, there is not enough time or resources to convert RPG developers into Java developers. The logical step to bring your business critical applications to the Web is with RSP. RSP gives the developer the tools necessary to create fast and reliable Web applications.

Download your FREE copy of RSP today!

www.damontech.com


THIS ISSUE
SPONSORED BY:

Profound Logic Software
PKS Software
Damon Technologies
ASNA


BACK ISSUES

TABLE OF
CONTENTS
Building Applications with Ant

Swapping AS/400 User Profiles

IBM's Toolbox for Java Is Getting Better Every Day

More on Edit Words


Editors
Shannon O'Donnell
Kevin Vandever

Managing Editor
Shannon Pastore

Contributing Editors:
Howard Arner
Raymond Everhart
Joe Hertvik
Ted Holt
Marc Logemann
David Morris

Publisher and
Advertising Director:

Jenny Thomas

Advertising Sales Representative
Kim Reed

Contact the Editors
Do you have a gripe, inside dope or an opinion?
Email the editors:
editors@itjungle.com


Copyright © 1996-2008 Guild Companies, Inc. All Rights Reserved.