01
Wed, May
6 New Articles

Weaving WebSphere: JTOpen--The Right Tools for the Job

Development Tools
Typography
  • Smaller Small Medium Big Bigger
  • Default Helvetica Segoe Georgia Times
"If the only tool you have is a hammer, you tend to see every problem as a nail."
--Abraham Maslow

"An apprentice carpenter may want only a hammer and saw, but a master craftsman employs many precision tools. Computer programming likewise requires sophisticated tools to cope with the complexity of real applications, and only practice with these tools will build skill in their use."
--Robert L. Kruse

I'm starting this column with two quotes rather than just one. That's because I think this column's focus is so important. Not just the feature topic, IBM's JTOpen project, but also the general idea of using the right tools.

In this column, I'm going to present my opinion on choosing the right software solution. Then, I'll introduce IBM's Java Toolbox for AS/400, both the Licensed Program Product (LPP) version and the open-source JTOpen version, either of which will give you the ability to design your WebSphere applications in a way that makes sense for your particular business needs. Finally, I'll give you some input as to which version of the Toolbox is right for you.

Who? Me? Argue? Nahhh.

It may surprise you, but I've been embroiled in a few mailing list debates over the past several months. In some of these, I have opined that there is no single answer for all programming questions. I've argued that SQL has its place, but that RLA performs better. I've argued that Java is the best language for creating user interfaces, but that RPG is by far the better language for business logic. I've argued that procedural languages have their place, and that--heresy!--object-oriented programming isn't the universal panacea.

My point is that each business problem is unique, and you should identify the business problem and its parameters before deciding on things like languages and architectures. As Maslow makes clear in his famous phrase, if you start out with a solution in mind, the problem tends to get skewed toward that solution.

In servlet programming such as the kind done with WebSphere, there are two schools of thought: JDBC and everything else. JDBC proponents argue that JDBC is "platform independent" and so makes it easy to move your applications off of the machine. Detractors point out that JDBC ties your clients to your database design (and vice versa!) and also suffers from some serious performance problems. Each approach has its place in an implementation, but you must have all your options available in order to make an informed decision.

In its current incarnation, IBM's Java Toolbox allows you to do just that. The Toolbox is, in my opinion, one of the most significant pieces of iSeries software ever written. Not only that, the package is free. Not only that, but the version I'm talking about today--the JTOpen version of the toolbox--is open source!

An Introduction

When the IBM Toolbox was first made available way back in 1998 or so, it was an eye-opening experience. IBM had evidently decided to become very serious about making Java interoperable with legacy AS/400 systems. Subsequent announcements, from the availability of Linux to the pumping up of QShell to the most recent ability to call Java directly from RPG have all reinforced that idea.

The Toolbox has capabilities I wouldn't have imagined possible. By hooking directly into the host servers originally used by Client Access, the Toolbox makes available direct access to nearly every aspect of OS/400--from database to data queues. You can call a program, execute a command, or create a spooled file, all using native Java classes. Best of all, the Toolbox is 100% Pure Java, which means any code you write will run just as well on a PC as on the iSeries--or on a Linux box, a Sun Blade, or a Mac!

The Toolbox includes classes supporting the following OS/400 functions:

  • File access, including JDBC, record-level access, and data conversion
  • Integrated File System (IFS) access
  • Program calls (including PCML) and command calls
  • Printers, spooled 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


These classes can be used in programs on any platform, including the iSeries. Another series of classes provides GUI access to various resources on the AS/400, from spooled files to system values. However, these require the Swing classes, and since these are not implemented on the iSeries, these classes not readily available to native OS/400 programs. This column focuses exclusively on the classes that can be used within the WebSphere environment, but as you can see from the list above, that's still a substantial number of resources.

For more information on the LPP version of the Toolbox, you can go to the V5R1 Java Toolbox home page.

JTOpen: The Icing on the Cake

The licensed version of the Toolbox would be enough in and of itself to cause a lot of excitement. It's an incredibly robust and powerful set of packages, and there are major new features being added in every release. Be sure to review the major announcements regarding the LPP version of the Toolbox, and watch future issues of MCMagOnline for upcoming articles by IBMer Robb Wiedrich.

However, I am going to introduce you to something even more special, at least in my opinion: the open-source version of the Toolbox, known as JTOpen.

While it is closely linked with the LPP version of the Toolbox, JTOpen is also somewhat independent of it. JTOpen has a small group of individuals assigned to its Core Team, three from IBM and two from the industry. The IBM participants are Cheryl Renner, Chris Smith, and Bill Wiktor. The non-IBMers are Steve Johnson-Evers and your humble reporter. (Those jeering at the word "humble" are kindly reminded that this is a no-heckling zone!)

In the spirit of any true open-source project, the team accepts input (and even code!) from any interested individuals. That means that by getting involved with the JTOpen package, you can actually contribute to and help shape the future of the package.

What's So Special?

Well, the first special thing about JTOpen is the fact that it's basically a superset of the LPP version, with additional features and fixes. Things that will eventually be included in the LPP version appear first in JTOpen.

For example, JTOpen is already up to JDBC 3.0, while the LPP version is still at JDBC 2.0. Also, there are some incidents relating to fields of type date in JDBC that are fixed in JTOpen. In fact, whenever there is an issue relating to JDBC, the recommendation is to try the code using the latest JTOpen version.

Bugs in general get fixed much more quickly with JTOpen. There have been times when bug fixes have been available literally within hours, in contrast with the typical six-month cycle for LPP releases.

The open-source community has gotten involved as well. Things that appear in JTOpen ahead of the LPP include validation list support (from Tom Johnson at Kingland), limited S/36 file support (from Neal Wenderlich at USDA), a classpath optimizer utility (from Glen Marchesani), the Toolbox Micro Edition classes for handheld/mobile devices
(from Robb Wiedrich at IBM), and the PTF and ProductList classes (from Chris Smith at IBM). This list comes directly from Chris Smith and is a great demonstration of the power of open source.

There are also additional usability features. The latest release, JTOpen 3.1, provides the ability to use Apache Ant to create your own version of the JTOpen .jar files. This allows you to more easily include your own modifications and enhancements to the Toolbox. A new utility class, CommandHelpRetriever, is available in the com.ibm.as400.util package. It will generate HTML help text for any specified CL command(s) on the fly.

But perhaps the single most important advantage of JTOpen is the "source" aspect of "open source." All source for the Toolbox, with the exception of a few security-related classes, is available for review and download. For example, click to see the source for the AS400ZonedDecimal class, which converts data between packed decimal format and a Java BigDecimal. You can see exactly how IBM does things. And while this class isn't too involved, you can just as easily review the source for, say, the JobLog class, which is a wonderful example of how to use the QGYGTLE and QGYOLJBL system APIs within a Java program.

Which One Is Right for Me?

Which is the better solution depends upon your situation, but unless you are a software vendor, there is really no reason not to use JTOpen. The only caveat may be that, given the volume of enhancements and fixes, there is always the possibility that a fix to one feature might cause a bug somewhere else. But as long as you follow the reasonable procedure of testing a new release before putting it into production, the really overwhelming number of features included in JTOpen would outweigh any possible negatives.

Software vendors and IS managers supporting multiple sites and differing release levels need to be a little more careful. If your software depends on the latest version of JTOpen, then you should probably distribute JTOpen with your software--or at least have really good instructions on downloading and installing the latest and greatest version. If your audience isn't particularly familiar with downloading and installing .jar files and the latest LPP has enough function in it for your product, then you may want to at least have an installation option that works with just the LPP version.

The JTOpen team strives very hard to be backward-compatible, but that's not always possible, especially with major enhancements. In that case, you may want to standardize on the known quantity represented by the LPP version. But for any other use, the JTOpen package is by far the best way to go.

And even if you're a software vendor, you should have the latest version of JTOpen in your development environment, because JTOpen gives you an idea of where the LPP is headed. Compatibility with JTOpen will go a long way toward getting you ready for future releases of the LPP.

Conclusions

Let me get back to my original point about the right tool for the job. In the context of WebSphere, the single most common requirement is to get data from the database into the Web application. For most Java programmers, the initial answer is probably going to be to use JDBC. Without getting into a discussion of the merits and pitfalls of JDBC, I want to point out that the Toolbox offers a variety of other options.

The record-level access classes, for example, allow you to write code that handles the database just as you would in an RPG program: opening files, positioning the cursor, reading and updating records in place, and so on. The data conversion classes handle all the work of converting between DB2 format and Java objects, much the same way that SQL does--only without having to learn the SQL syntax. Logical files can be used to select and sequence records, allowing you to avoid having to format WHERE and ORDER clauses. In tests I've run, many functions run more quickly with record-level access than they do with JDBC.

Or I could call a server program. Let's say the data required is dependent upon some complex business logic. An example I like to use is order pricing. In a simple storefront, it's relatively easy to access a file and retrieve the price for an item. But in most real-world systems I've seen, pricing is a very sophisticated process, involving many files and a lot of database access based on customer, item, sales to date, promotions, and any number of other issues. In fact, many ERP systems have entire programs devoted entirely to calculating the price for an item. In that case, it would be counter-productive to rewrite this business logic in either JDBC or record-level access; instead, it would be best just to call the existing pricing program. And while I might be able to make this particular call using a stored procedure, there are other examples that require more bi-directional data capability than a stored procedure can provide.

Enter the Toolbox. With the Toolbox, I can choose any of these options and more besides. I can execute commands or access data queues. I am no longer limited to the syntax of SQL or encumbered by having to rewrite business logic in Java. Instead, I can easily make use of whichever tool is right for the job.

And for that, IBM, I thank you.

Joe Pluta is the founder and chief architect of Pluta Brothers Design, Inc. He has been working in the field since the late 1970s and has made a career of extending the IBM midrange, starting back in the days of the IBM System/3. Joe has used WebSphere extensively, especially as the base for PSC/400, the only product that can move your legacy systems to the Web using simple green-screen commands. You can reach Joe at This email address is being protected from spambots. You need JavaScript enabled to view it..

Joe Pluta

Joe Pluta is the founder and chief architect of Pluta Brothers Design, Inc. He has been extending the IBM midrange since the days of the IBM System/3. Joe uses WebSphere extensively, especially as the base for PSC/400, the only product that can move your legacy systems to the Web using simple green-screen commands. He has written several books, including Developing Web 2.0 Applications with EGL for IBM i, E-Deployment: The Fastest Path to the Web, Eclipse: Step by Step, and WDSC: Step by Step. Joe performs onsite mentoring and speaks at user groups around the country. You can reach him at This email address is being protected from spambots. You need JavaScript enabled to view it..


MC Press books written by Joe Pluta available now on the MC Press Bookstore.

Developing Web 2.0 Applications with EGL for IBM i Developing Web 2.0 Applications with EGL for IBM i
Joe Pluta introduces you to EGL Rich UI and IBM’s Rational Developer for the IBM i platform.
List Price $39.95

Now On Sale

WDSC: Step by Step WDSC: Step by Step
Discover incredibly powerful WDSC with this easy-to-understand yet thorough introduction.
List Price $74.95

Now On Sale

Eclipse: Step by Step Eclipse: Step by Step
Quickly get up to speed and productivity using Eclipse.
List Price $59.00

Now On Sale

BLOG COMMENTS POWERED BY DISQUS

LATEST COMMENTS

Support MC Press Online

$0.00 Raised:
$

Book Reviews

Resource Center

  • SB Profound WC 5536 Have you been wondering about Node.js? Our free Node.js Webinar Series takes you from total beginner to creating a fully-functional IBM i Node.js business application. You can find Part 1 here. In Part 2 of our free Node.js Webinar Series, Brian May teaches you the different tooling options available for writing code, debugging, and using Git for version control. Brian will briefly discuss the different tools available, and demonstrate his preferred setup for Node development on IBM i or any platform. Attend this webinar to learn:

  • SB Profound WP 5539More than ever, there is a demand for IT to deliver innovation. Your IBM i has been an essential part of your business operations for years. However, your organization may struggle to maintain the current system and implement new projects. The thousands of customers we've worked with and surveyed state that expectations regarding the digital footprint and vision of the company are not aligned with the current IT environment.

  • SB HelpSystems ROBOT Generic IBM announced the E1080 servers using the latest Power10 processor in September 2021. The most powerful processor from IBM to date, Power10 is designed to handle the demands of doing business in today’s high-tech atmosphere, including running cloud applications, supporting big data, and managing AI workloads. But what does Power10 mean for your data center? In this recorded webinar, IBMers Dan Sundt and Dylan Boday join IBM Power Champion Tom Huntington for a discussion on why Power10 technology is the right strategic investment if you run IBM i, AIX, or Linux. In this action-packed hour, Tom will share trends from the IBM i and AIX user communities while Dan and Dylan dive into the tech specs for key hardware, including:

  • Magic MarkTRY the one package that solves all your document design and printing challenges on all your platforms. Produce bar code labels, electronic forms, ad hoc reports, and RFID tags – without programming! MarkMagic is the only document design and print solution that combines report writing, WYSIWYG label and forms design, and conditional printing in one integrated product. Make sure your data survives when catastrophe hits. Request your trial now!  Request Now.

  • SB HelpSystems ROBOT GenericForms of ransomware has been around for over 30 years, and with more and more organizations suffering attacks each year, it continues to endure. What has made ransomware such a durable threat and what is the best way to combat it? In order to prevent ransomware, organizations must first understand how it works.

  • SB HelpSystems ROBOT GenericIT security is a top priority for businesses around the world, but most IBM i pros don’t know where to begin—and most cybersecurity experts don’t know IBM i. In this session, Robin Tatam explores the business impact of lax IBM i security, the top vulnerabilities putting IBM i at risk, and the steps you can take to protect your organization. If you’re looking to avoid unexpected downtime or corrupted data, you don’t want to miss this session.

  • SB HelpSystems ROBOT GenericCan you trust all of your users all of the time? A typical end user receives 16 malicious emails each month, but only 17 percent of these phishing campaigns are reported to IT. Once an attack is underway, most organizations won’t discover the breach until six months later. A staggering amount of damage can occur in that time. Despite these risks, 93 percent of organizations are leaving their IBM i systems vulnerable to cybercrime. In this on-demand webinar, IBM i security experts Robin Tatam and Sandi Moore will reveal:

  • FORTRA Disaster protection is vital to every business. Yet, it often consists of patched together procedures that are prone to error. From automatic backups to data encryption to media management, Robot automates the routine (yet often complex) tasks of iSeries backup and recovery, saving you time and money and making the process safer and more reliable. Automate your backups with the Robot Backup and Recovery Solution. Key features include:

  • FORTRAManaging messages on your IBM i can be more than a full-time job if you have to do it manually. Messages need a response and resources must be monitored—often over multiple systems and across platforms. How can you be sure you won’t miss important system events? Automate your message center with the Robot Message Management Solution. Key features include:

  • FORTRAThe thought of printing, distributing, and storing iSeries reports manually may reduce you to tears. Paper and labor costs associated with report generation can spiral out of control. Mountains of paper threaten to swamp your files. Robot automates report bursting, distribution, bundling, and archiving, and offers secure, selective online report viewing. Manage your reports with the Robot Report Management Solution. Key features include:

  • FORTRAFor over 30 years, Robot has been a leader in systems management for IBM i. With batch job creation and scheduling at its core, the Robot Job Scheduling Solution reduces the opportunity for human error and helps you maintain service levels, automating even the biggest, most complex runbooks. Manage your job schedule with the Robot Job Scheduling Solution. Key features include:

  • LANSA Business users want new applications now. Market and regulatory pressures require faster application updates and delivery into production. Your IBM i developers may be approaching retirement, and you see no sure way to fill their positions with experienced developers. In addition, you may be caught between maintaining your existing applications and the uncertainty of moving to something new.

  • LANSAWhen it comes to creating your business applications, there are hundreds of coding platforms and programming languages to choose from. These options range from very complex traditional programming languages to Low-Code platforms where sometimes no traditional coding experience is needed. Download our whitepaper, The Power of Writing Code in a Low-Code Solution, and:

  • LANSASupply Chain is becoming increasingly complex and unpredictable. From raw materials for manufacturing to food supply chains, the journey from source to production to delivery to consumers is marred with inefficiencies, manual processes, shortages, recalls, counterfeits, and scandals. In this webinar, we discuss how:

  • The MC Resource Centers bring you the widest selection of white papers, trial software, and on-demand webcasts for you to choose from. >> Review the list of White Papers, Trial Software or On-Demand Webcast at the MC Press Resource Center. >> Add the items to yru Cart and complet he checkout process and submit

  • Profound Logic Have you been wondering about Node.js? Our free Node.js Webinar Series takes you from total beginner to creating a fully-functional IBM i Node.js business application.

  • SB Profound WC 5536Join us for this hour-long webcast that will explore:

  • Fortra IT managers hoping to find new IBM i talent are discovering that the pool of experienced RPG programmers and operators or administrators with intimate knowledge of the operating system and the applications that run on it is small. This begs the question: How will you manage the platform that supports such a big part of your business? This guide offers strategies and software suggestions to help you plan IT staffing and resources and smooth the transition after your AS/400 talent retires. Read on to learn: