Ancient Technologies - RPG & AS/400

Posted Sunday, March 21, 2004 2:20 PM by CumpsD
I just finished a school project in RPG. In the beginning I hated RPG and the AS/400 it was running on. When you're used to writing languages like PHP, C++, C#, Perl and even batch, RPG seems like a nightmare, crazy syntax, column based, numeric vs character variable handling, ...

And then we had to do a project for that class. The teacher talked about a previous group doing something with HTML and CGI on the AS/400, so I decided to take on the challenge and write a complete website that uses the AS/400 as back-end with RPG as the language.

Some obstacles I encountered:
  • The website was going to be written in PHP, but our AS/400 didn't support it, so the decision was quickly made to host the site on another server. But this adds the added difficulty of communicating between site and AS/400. In the end the site is running on Windows 2000 with IIS and uses DB/400 for data storage on the AS/400.

  • The first communication attempt: DB/400 supports stored procedures, so we'll just access the RPG programs trough sprocs. But again, problems, at first we simply couldn't connect to the server, we later figured out it had to do with permissions. But after those permissions there was no way I could call a sproc from PHP.

  • So I changed the way of communicating. First I created a PHP class that can easily construct a command to call the RPG program. It takes the program name and parameters and execute it. What happens in the back is, a querystring is constructed, it gets called on the AS/400, there a program pulls in the querystring and parses it, after which it calls the apropiate RPG program. Each RPG program has some return value which gets send back to the PHP object that initially made the call and then the returned info gets processed on the website.

    Here's how it goes in the final result:

Ofcourse there were also a lot of obstacles getting to know RPG and the way it works with the system, especially in the capitalization departement, sometimes it's case sensitive when you don't want it, and another time it's back to case insensitive.

But in the end, now it's finished, I'm amazed of the result. A fully working PHP website on a seperate server, running Windows, with an AS/400 back-end, using RPG as the language to talk with DB/400. It amazes me that a technology that old can play along with a new technology like PHP.

What do you think about ancient technologies? Do solutions like the one I just described still happen? Did you made one already?

I'd really like to know how much of these things still happen in the business world, because as a student I really have no idea.
Filed under:

Comments

# re: Ancient Technologies - RPG & AS/400

Sunday, March 21, 2004 8:51 AM by Sven Cipido

This looks great. I know AS/400 is used a lot in the business world, and yes I know how difficult it is to program the AS/400. I've done it for 4 years.

I don't know if you already know, but Microsoft has also a solution to use the AS/400 as back-end. it's named Host Integration Server 2004 (HIS). At this moment it's still in Beta 2. Whit HIS, you can call RPG programs from withing VS.net and visa versa;

I have used HIS now for a few months, and we're implementing this server for a customer. The big advantage is that you can leave all your business logic and the database site on the AS/400. You just have to write an interface between the two in HIS and the front end in f.e. ASP.Net.

You can find some information, troubles and there solution on my blog.

# re: Ancient Technologies - RPG & AS/400

Sunday, March 21, 2004 9:12 AM by David Cumps

Didn't knew that :) Thanks for mentioning, going to check it out once. (Althou I really hope to stay away from any AS/400's in the future :p)

# re: Ancient Technologies - RPG & AS/400

Sunday, March 21, 2004 9:24 AM by Guest

yeap! RPG! i think it stands for Role Playing Games.....:p

# re: Ancient Technologies - RPG & AS/400

Sunday, March 21, 2004 9:37 AM by denny

RPG

Really
Painfull
&
Gruesome

:-)

# re: Ancient Technologies - RPG & AS/400

Sunday, March 21, 2004 12:28 PM by Patrick Verbruggen

Do solutions like the one you described still happen? Oh YES, they do. Lots of them. A large number of SMEs (or KMOs as we know them in Belgium) still run AS/400s as their mission critical system (which is not such a bad idea: they are *very* dependable machines!)

I haven't built such a solution myself, but a fair number of my colleageus @ Real Software have built (and are sometimes still building) them.

# re: Ancient Technologies - RPG & AS/400

Sunday, March 21, 2004 2:42 PM by David Cumps

Ouch, I hope their dev environments are better then what I went trough when creating this. Maybe something to do with the academic environment that doesn't use tools ;)

# re: Ancient Technologies - RPG & AS/400

Monday, March 22, 2004 1:55 PM by Bertg

Taking notes...
could use it soon :p

# re: Ancient Technologies - RPG & AS/400

Saturday, July 17, 2004 11:23 AM by TK

Hi - i am a student and would like to learn a little about integrating different technologies. I am looking into the integration of technology of two different companies, here are some details...

company 1 -
win2000, pentium machines, UX
switching tech in LAN
leased line WAN
Oracle Technology
turnkey apps
legacy apps (CICS, VSAM, IMS, MVC)
company wide integrated internet and email (MS EXchange)

company 2 -
IBM host and SNA environment
AS400 amd BPCS
Near company wide email (Lotus Notes)

my aim is to integrate the two in the best way.
consolidate group communications (intra company WAN)
extend network for voice and data integration
enforcing security

also, company 1 has sites worldwide and company 2 is in a different country.

please could you advise me on a wise move for integration.

thanks

# re: Ancient Technologies - RPG & AS/400

Friday, November 17, 2006 2:53 PM by Joe Rattz

I have an intranet web application that runs in ASP.NET that interfaces with AS/400s quite a bit.  The AS/400 can be a challenge to interface with.  

However, using OleDb, I can connect to the database for data, and using the cwbx.dll, I can actually call RPG programs on the AS/400.

Here is a link to an article I wrote describing how to do this:

http://www.netsplore.com/PublicPortal/Articles/ASPNETArticles/CallingAS400AS400RPGProgramsFromASPNET/tabid/246/Default.aspx

# re: Ancient Technologies - RPG & AS/400

Friday, November 17, 2006 6:26 PM by CumpsD

Lucky you, we didn't get oledb to work at all at that time :/

# re: Ancient Technologies - RPG & AS/400

Wednesday, February 14, 2007 3:23 AM by lakshmikant

I need sample RPG400, RPGILE programs pdf. You have any idea about this i mean say any sites or you collected some programs folder....let me know i will check that programs for my better capabilities.

# re: Ancient Technologies - RPG & AS/400

Tuesday, August 28, 2007 11:12 AM by Tommy

take a look at free-format RPG IV...it's much more like "modern" programming languages and should be easy enough for any of you to understand....