PHP and the i

We’ve talked about a lot of weird things so far on SitePoint (well, at least I think some of them are weird), but this may take the cake. In this series I want to talk to you about PHP – and the IBM I. That’s right, the IBM i, formerly known as System i and before that as the AS/400. Let’s start by dispelling the myth that the i is dinosaur; it’s actually a very wonderful machine, and there are lot of opportunities for brave PHP programmers who venture into this realm.

The Truth About the i

Before you get up in my face about the i being a dinosaur, not a real option in the high tech Windows 8 world of today, let me caution you that the closest I’ve ever come (as an adult) to getting into a fight in a bar was over the i. In my defense, I had just gotten off a four hour flight, it was late, and I was trying to catch the NFL scores for the day. Still, you might want to tread lightly here.

Yes, the IBM i has been around since the late 70’s or early 80’s depending on how you look at it. But it’s not an old fashioned machine and the kernel for Windows and Unix date from roughly the same time period.

If the adage comparing Unix to buying a car that you have to assemble yourself, and Windows to a car that needs to be repaired before you can drive it, is true, then it’s also true that the i is like getting a car off the showroom floor completely assembled and ready to go.

The hallmark of the i is its level of integration. All aspects of the machine are integrated: the language, the database, the operating system. It’s a very fast machine (up to Power-7 chips now), is very scalable (from blade servers to mega systems), and has a very advanced operating system that separates the hardware from the software (making it very easy and transparent to switch from 32-bit hardware to 64-bit with no changes required to the programs – this happened in the late 90’s; all i programs are 64 bit) and has a security structure that is unrivaled. No IBM i system has ever been successfully hacked.

OMG – it’s a system from heaven! So why doesn’t everybody have one? The i is a clear winner if you look at any study that focuses on the total cost of ownership over several years, but we are a quarterly-driven society. The acquisition price of the i is more expensive than a Windows server. Moreover, IBM has never seen fit to provide a native GUI interface to the i. Those who use green screens are loath to switch to a GUI or browser configuration because it’s so much easier to enter data and commands directly, but today’s reality is that you have to have a pretty GUI.

The i and GUI

So, we’ve proven that I love the i, but what does that have to do with you? For the past 40 years, RPG programmers on the i have been churning out green screens at an incredible rate. And now, suddenly, everyone wants them to produce browser-based screens. The problem is, there’s no native way to do this on the i (this isn’t the same as saying that there is no way to do this on the i, but rather that doing it is not something that RPG programmers naturally have their hands around).

We could replace RPG on the i with something that is browser-based. Maybe Java. Or .Net. The problem with this is that for business logic, which involves a lot of logic and calc and case structures, there is nothing better than RPG (unless you use COBOL to which most i people are severely allergic). As a result, RPG is here to stay and the basic programs required by the ERP systems that run on the i will continue to use RPG.

In the i world there are a number of options to creating the screens and then interfacing them with the RPG logic. And every educator in the i world is busy trying to entice RPG programmers to learn one of a number of options, PHP being one of them.

The problem that most RPG people face is that they have gone through multiple head count reductions over the past 10 years and most of them don’t have time to do what they need to do with RPG, much less learn something new. That means that the i world is in a position to use people who have PHP knowledge but don’t know anything about RPG.

RPG and Stuff

For those of you who don’t know anything about RPG (and I would guess that is most of you), RPG started out as a simple report writer. But nothing stays simple forever.

Initially, RPG people tended to write big programs, with a single program containing screen build, control logic, and business logic. But with the introduction of RPG ILE about 10 years ago, the tide began to turn. ILE made RPG much more efficient in how it called sub programs and now a lot of people are pushing the MVC pattern with RPG handling the model and controller but something else, like PHP, to do the view.

Most companies would use MVC except for one problem; their normal RPG programmers may be able to do ‘Hello World’ in PHP but they aren’t ready to develop complicated screens or deal with the network consequences of those screens (sessions, cookies, REST, etc.). That opens a real opportunity for PHP programmers who can do those kinds of things and who are willing to work within an i framework.

Getting Started

So with a potential revenue stream waiting to be tapped, the question is how do you, the PHP programmer, do just that?

First, get over thinking of the i as an outdated machine. I have yet to see anyone who gets familiar with the environment who doesn’t wonder why all computer systems are not like it.

Second, you need to gain some familiarity with RPG. No, you don’t need to know how to code it, but you should know how to deal with it. That is, how does RPG ILE work and how can you use it to allow you to do the screens (pages) for the RPG applications in PHP. Often, the people you will be dealing with will need to be helped to understand how PHP can fit into their plans and what they have to do to set RPG up to be PHP friendly.

Third, setting up business pages is different from pages for web sites, so one of the things you should do is become familiar with the differences and how to set them up for maximum efficiency.

Conclusion

That’s all they’ll let me write for this part. But stay tuned dear reader, as next week I’ll dive into what developing on the i is like for the brave PHP programmers who venture into this realm!

Image via Fotolia

Sponsors