How to Make More Out of IBM i

by Norbert Sepp (Client Technical Architect at IBM Hungary)

The other day, at a wedding I heard a parable:

At sunset, a young lad was wandering about on the beach, when he found a bag of small stones. Being bored, he played throwing pebbles in the ocean, until he threw all but one pebble. He put the last piece in his pocket and walked back home.

Only when, by the fireside he looked at it again, could he realize, it was a beautiful diamond.

Indeed, it occurred to me, way too often we do not look at things from the right angle.

Modest, quiet ones may be wasted if we fail to shed light on them from different points of view.

It is therefore worth revisiting a worthy one that had earned a strong reputation but is nowadays less praised for its merit.

Looking at things from new perspective is always exciting!

The platform, originally named AS/400 turned 30 this year.

Those who know it have been since fascinated how much talent – progressive and timeproof concepts – have been integrated into it from the beginning.
And though 30 might sound long at first glance, the IBM i (it is the current name) is a modern platform, that keeps up with latest trends, continuously evolving without sacrificing the foundational principles.

In a series of posts we attempt to elucidate this by showing different facets of this gem, illustrating how the platform can serve various IT needs from legacy or web-tech developers through data scientist to CIOs.

Being open

Though traditionally marked by its efficient 5250 green screen interactive environment in the OS/400 era, the IBM i was quick to follow popular trends of client/server (PC Support), and graphical interfaces (Client Access, iSeries Navigator among others), never sacrificing stability and security in exchange for glamour.

Administrators on various platforms are still using the command-line and terminals to perform system tasks in the most effective manner, however, end users prefer browser-based or mobile access to backend applications.

Two of the most popular solutions are PHP and Node.js, both of which have been natively supported on the IBM i for years.

JavaScript and Node.js

JavaScript is without a doubt, among the most popular development practices.

The server-side, browserless engine, Node.js is based on the Google Chrome V8 Javascript Engine.

It is very efficient and easy to be extended with npm (node’s package manager) quickly improving its functionality with third-party modules, or popular frameworks like Express or Koa.

On V7R1M0 to get Node.js, one should install select options of no-charge LPOs (Licensed Program Offerings):

  • Option 10 of 5733OPS (Open Source Solutions) which is included in the Bonus Pack,
  • along with other prerequisites: PASE environment; IBM HTTP Server; and OpenSSH, OpenSSL, zlib.

This Node.js version (V6) already contains two important, IBM i-specific extensions:

  • IBM DB2 for i access libraries (superceded by idb-connector package)


  • js Toolkit for IBM i. (superceded by itoolkit package).

The first one lets Node.js programs interact with the integrated database, whereas the second option (through XMLSERVICE) allows the programs to access the operating system structures: objects, system values, user spaces, data queues and so on.

(Starting from V7R2M0, Open Source RPMs replace 5733OPS for obtaining Node.js (V8).)

To ease the database access for the programmers – since all SQL CLI APIs are exposed – only one module, db2a.js is enough to be required, and through that, database functions can be invoked from the program.

The SQL query returns the result set in JSON format, that can be converted to text with the stringify() method, or the key-value pairs can be directly processed.

For the XMLSERVICE-based object access, some limitations apply, and the basic functionality is provided by itoolkit.js that will always be required and lets the program invoke CL and QSHELL commands, service programs procedures and SQL statements.

Additional functionality is delivered through iwork (system and job status), iprod (LPP and PTF information), iuserSpace (for user spaces), inetwork (network information), iobj (object authorities) and idataq (for data queue manipulation).

If you think the limitations are restrictive, reconsider it by envisioning a scenario where the required action is supported by a native solution, „packaged” within a CL program and accessed through itoolkit.

It is far from straightforward, you would call it slightly complicated, however, you can still enjoy the other benefits of the platform, like security, scalability and reliability.

Luckily, there are other options left „open” for the task.

Other languages

Modern programming follows not only the DRY (Don’t Repeat Yourself) concept, but also the DREW (Don’t REinvent the Wheel) advice: if someone has written good code for a task, one should rather try reusing it than start the coding from scratch.

Nowadays, many snippets are freely available, and time-stressed development is less forgiving for not using this possibility.

There is valuable code out there in other languages (besides, JavaScript is not necessarily the favourite of many), so it makes sense to immigrate programs with their original citizenship.

PHP has been around for quite a while (strongly supported by Zend with various, IBM i-friendly offerings), and Python V2 or V3 are also available if one prefers their flavour.

Recently Ruby on Rails has come out from PASE to widen the spectrum of choice.

All of these programming languages deliver tools to access IBM i-native structures: DB2, the object hierarchy and many system services, like system values, data queues, security or work management functions.

Using open source programming possibilities is an effective way to breed modernity and flexibility with legacy values.

Speak the right language

Open source technologies are natively EBCDIC-phobic. Node.js, for example requires UTF-8 (or compatible) encoding, so accessing legacy data requires patience and preparedness.

The character set to be used is determined after the evaluation of complex rules, considering the user profile settings, the file CCSID, the job CCSID and the QCCSID system value.

The final setting defines what kind of conversion should be performed, in order for the result to appear correctly.

Some character set IDs are UTF-8 friendly, but if you see Mojibake, you had better roll up your sleeves for a systematic investigation.

The truth is, that with good planning you leave no space for accidents, because the IBM i is easy to tame; its versatility requires the user to invest time to know it, but the return comes quickly and even stays.

Polishing the gem

In the upcoming posts we will roam over the platform, discussing interesting features of the platform: examining the database; mentioning how it can serve as a machine learning platform; talking about interesting security structures and the like.

Stay with us along the journey.

Note: IBM, AS/400, OS/400, Client Access, iSeries Navigator and ’IBM i’ are trademarks or registered trademarks of IBM Corp. Node.js is an official trademark of Joyent, Inc. Ruby on Rails is a registered trademark of David Heinemeier Hansson. ’Python’ is a registered trademark of the Python Software Foundation.