You are currently on IBM Systems Media’s archival website. Click here to view our new website.


The Completely Different World of Python With IBM i

Times have changed in the IBM i Application Development (AD) world—and in our opinion for the better. When the original AS/400 was launched some 27 years ago, very few programming languages were available to us. In practical terms, we were pretty much limited to RPG, COBOL and CL. Sure PL/I, Fortran and Basic and were also available but their usage was very limited and they have not been available for many years now. Before anyone corrects us, yes, there are a few software vendors that still cling to a version of PL/I but this is by special arrangement and the compiler is not available as a standard offering.

The most obvious omission at the time was the C language, a deficiency that was remedied at the end of 1993 with the advent of V2R3. IBM subsequently added C++.

But the speed of change was increasing and more and more modern languages were appearing in the AD space. After flirting for a while with Pascal and Smalltalk, IBM switched focus to Java and released the first version for the system in 1997. After this things quieted down for a few years—at least on the official IBM front.

Some individuals used the PASE environment to port various languages (including PHP back in 2003 or so) but there was nothing official. Then in 2005, IBM announced that PHP would officially be supported on the platform and we were off and running. The success of PHP increased demands for other open-source languages to be made available. Ruby was next on the scene and has made quite a splash ( Although it doesn’t directly support Ruby, IBM has made it very clear that it’s supportive of this effort.

IBM did, however, deliver a port of node.js in late 2014 that was greeted with enthusiasm. At that time it also stated that there were plans to introduce more open-source languages and true to its word, hot on heels of node.js came the delivery of the subject of this article—Python. Now while this is the first official IBM port of Python to the IBM i, the language has been available on the platform for a number of years courtesy of the Python enthusiasts behind the iSeries Python website.

What Is Python?

Python is a general-purpose programming language that saw its first formal release back in 1994. As you may have guessed from the title of this article, it was named after the British TV series “Monty Python’s Flying Circus.” This is a legacy that lives on in the documentation where variable names such as “spam” will often be used in preference to the boring old “x” or “foo” names that you find with other languages. This is not to say that Python is not a serious programming language—far from it.

Our first introduction to Python was when a reader wrote to tell us about it in response to an article we wrote encouraging RPGers to try PHP. His perspective was that Python was a much better language than PHP and that really we should be recommending it to RPGers. For us, there was a two-fold problem with this. The first was that there was no official Python implementation for IBM i. The second was that everything we read on Python, and all the examples we encountered, led us to believe that it was a completely object oriented (OO) language—far more on a par with Java than with PHP’s “Use OO or not—your choice” attitude. Since many RPGers had found PHP far easier to learn than they had ever found Java to be, there didn’t seem to be a lot of point in digging any further into Python at the time.

Once our first stumbling block was removed with the official arrival of Python on the platform, we decided we should perhaps revisit the topic. But what about the OO aspect? It turns out that the earlier Python port has attracted a number of very enthusiastic users and during discussions with some of them, we found that our impressions of Python as an OO-only language were incorrect and that it can be used procedurally every bit as easily as PHP. With this second obstacle falling, we had run out of excuses and it was time to take a closer look.

So as IBM i professionals, why should we be interested in the language?

The first thing to note is that Python is truly a general-purpose language. By that we mean it can be used for any purpose from writing a desktop application, to a batch process, to a Web service, to a browser-based application, etc. In this regard, it’s more like RPG than PHP, which is primarily focused on browser-based applications. The big difference between Python and RPG in this regard is that the extensions needed to interact with the Web, etc., are effectively built into the Python language as part of its massive function library.

Speaking of the function library, massive is not really an adequate word to describe it. The range of capabilities available is simply staggering. Just to get an idea of just how much “stuff” is effectively built in, take a look at the library sections of the tutorial. You’ll find not only the usual date and time type operations but also functions for zipping files, processing XML, handling CSVs, and sending and receiving emails. And that’s just the standard library and doesn’t count the hundreds of free and commercial libraries that are readily available for everything from generating PDFs to processing Excel spreadsheets. As the tutorial notes, Python has a “Batteries Included” philosophy!

Jon Paris is a technical editor with IBM Systems Magazine and co-owner of Partner400.

Susan Gantner is a technical editor with IBM Systems Magazine and co-owner of Partner400.

Like what you just read? To receive technical tips and articles directly in your inbox twice per month, sign up for the EXTRA e-newsletter here.



2019 Solutions Edition

A Comprehensive Online Buyer's Guide to Solutions, Services and Education.

Are You Multilingual?

Rational enables development in multiplatform environments

IBM Systems Magazine Subscribe Box Read Now Link Subscribe Now Link iPad App Google Play Store
IBMi News Sign Up Today! Past News Letters