PHP Saves Company Millions by Refurbishing Old ERP System
Published: March 10, 2009
by Alex Woodie
A $1.7 billion construction company has saved millions of dollars in license fees and years of time by refurbishing a 30-year-old RPG-based ERP system with Zend Technology's PHP development tools rather than buying a new, brand-name ERP package in the seven figures. The two-year programming effort for APi Group of Minnesota paid off when its IT staff replaced all of the old 5250 green screens with Web interfaces, at a fraction of the cost, time frame, and pain of a full-scale ERP migration.
The APi Group was founded in 1926 as A.P.I. Inc, a small insulation contracting company that also distributed machinery. In the 1980s, the company started diversifying its holdings in the Midwest, and took its current name in 1997. Today, the St. Paul, Minnesota, firm is a holding company for dozens of smaller companies in the construction, safety, and fire suppression businesses, employing more than 9,000 people at 150 locations.
The company has grown primarily through acquisition, which has put special stresses on its information systems. More than 20 years ago, when it was a much smaller company with revenues in the neighborhood of $30 million to $40 million, it installed an RPG II-based ERP system on a System 3/x machine to help run its businesses. That ERP system was based on a no-name package developed by a very small software company that eventually went under. But after hiring the main programmer, APi Group succeeded in heavily customizing the package to do exactly what it needed it to do.
The old ERP system worked fine, except for one area--a major green-screen perception problem among the users of recently acquired companies. "There was huge pushback," says John Horner, the company's programming manager. "Even if we bought a smaller company that was running on Quicken or Timberline, to take them from a Windows or Web screens to an old green screen, they would just scream. The learning curve on it was huge. They didn't want to go on it. It was a constant problem."
About four years ago, the company decided it needed a more modern-looking computer system. First, the company considered migrating to a very well-known ERP package developed by a major vendor. However, the cost of the new system and the scope of the project kept growing. "Finally the president said we're not going to pay that much money, and basically pulled the plug," Horner says.
Next, the company decided to try out IBM's modernization roadmap, and see where it led. WebSphere, HATS, and other tools were played around with, but didn't take APi Group anywhere. "To me, it's screen scraping, and it doesn't do much for you," Horner says.
Finally, it was Horner who introduced APi Group to PHP. "When I came in (about two years ago), I had experience with PHP. I put a little demo together on what it can do. They bought in all the way, and said 'We're going to rewrite our application in PHP.'"
In fact, Horner's group of developers would use a combination of Zend's PHP development tools, a strong dose of SQL, and stored procedures written in RPG to completely change how the ERP system presents data, but without altering the underlying logic. They eventually succeeded, after learning some valuable lessons in enterprise PHP development along the way.
Lessons in AS/400-PHP Development
When Horner and his crew of a half-dozen IT workers set out to refurbish the ERP system, they wanted to minimize the impact to their AS/400. "We call a lot of our old stuff for the heavy-duty processing that we don't want to recreate," Horner says. "We don't want to re-create the program that generates paychecks. There's no reason to. Why reinvent those wheels?"
Instead, the focus was on refurbishing the user interface, which brought its own set of complications. The crew set out from scratch, hand-coding each screen to work with the underlying ERP system. With thousands of screens to convert, they quickly found a better way.
"Early on, we took a lot of lumps trying to write all this PHP," he says. "What we were finding is that 90 percent of it is the same stuff. The difference between an employee maintenance screen and a customer maintenance screen is just fields. So we kept building them, creating these building blocks, until we finally came up with these very powerful generators, both on the RPG and the PHP side."
The generators, which were developed in part with help from outside contractors, enabled Horner's group to rapidly generate the new PHP system. The programmers would enter the required information--including which stored procedures to call and which fields they want on the screen--into an array, call the generators, and it would automatically create everything needed, including menus, security, stored procedures, and connections to the AS/400.
"We had to create hundreds if not thousands of programs," Horner says. "We didn't have much of a choice other than to put on our thinking caps and say 'How can we get through this many programs in a short period of time?'''
In the end, the use of generators and the data dictionary enabled Horner and his group to fly through the screen generation. "It was a whole learning process of how this should really be done. I wish we could have started over again, because it would have taken half the time," he says.
As it was, the PHP development effort at APi Group, which is just wrapping up the project's first stage, was completed in about half the time estimated for the ERP migration. What's more, the PHP route was only one-tenth the cost, which corresponds to millions of dollars saved.
A Mix of Old and New
One of the important factors in redeveloping the old RPG program instead of dumping it for something new was the trust that APi Group has for the AS/400 server. "I'm a '400 guy," Horner says. "I love the reliability and robustness of it. It just works. With Zend bringing PHP to the '400, it's the best scripting language in the world with the best database in the world. It's like the best of both worlds."
While the combination of DB2/400 and PHP may be a good one for all sorts of uses, it doesn't eliminate the potentially touchy issue of how best to connect these two technologies. The question of whether to use native RPG techniques or SQL to access data from the AS/400 was a topic of consideration for the APi Group, as it is for every AS/400 developer trying to branch out from the traditional tools.
"We originally started this project on a Linux box, and used an ODBC driver to call AS/400 stored procedures, knowing that Zend was bringing it to the AS/400. We were kind of waiting for that," Horner says. "But there's no way we could have ran this on a Linux box for our whole company, with stored procedure calls through ODBC."
SQL is simply too slow to support the enterprise-level data access needs of APi Group, Horner says. "I keep hearing how great SQL is. We tried to do all SQL, and the lights dimmed sometimes when we ran processes," he says.
There are certain things that RPG does very well, and accessing data from DB2/400 is very high on that list. "You can't beat record level access," Horner says. "You'd have to build the exact perfect index on each file to make it run efficiently [with SQL], versus RPG, which just handles it."
To Horner's way of thinking, it's not an either/or scenario. "You use both of them," he says. "They both have advantages over the other one in certain areas. To me, this is going to save RPG. This is what RPG needed. RPG doesn't present data very well. OK, it's terrible. But what it does is get data efficiently."
APi Group subscribes to Zend Platform, which gives it several capabilities above and beyond the basic Zend Core PHP programming tools. One of these is the code caching mechanism, which helps reduce the load on the AS/400 by pre-caching compiled PHP objects. PHP compiles on the fly, but Zend Platform allows it to perform more like a pre-compiled program.
Even without Zend Platform and the code caching, APi Group's PHP software would run without any problem, Horner says. The company currently, has about 450 users on the new PHP system, with plans to eventually ramp that up to about 1,200 internal users. The current system handles about 25,000 hits a day without breaking a sweat. Just the same, the company is planning to upgrade its current System i Model 520 to a newer machine next year, which will give the PHP system even more overhead.
Horner marvels at the fact that PHP is basically free. Yes, the company spends $7,000 per year to get the benefits of Zend Platform, but the company could turn that off, move to Zend Core (which now ships with i OS 6.1) and not suffer much of a performance hit.
The end effect of being able to Web-enable a 30-year-old, highly customized ERP application for a fraction of the cost of installing a new ERP system is huge to a company like APi Group. "You think about a company like us, which keeps buying companies, keeps adding users. If we moved to [the leading ERP brand], our software cost never goes down. With PHP, we just stamp another company out, and the cost of software keeps going down."
"It's a perfect solution," Horner continues. "It doesn't cost anything. You get somebody who knows PHP, knows systems, knows how stuff should be written and designed--that's what you're going to pay for. To me, it's an absolute no brainer."