|Home||AS400 printing||AS400 Web||AS400 FAQ||Free AS400 Downloads||Pairwise Testing||Free Testing Downloads||Testimonials||Contact Us|
AS400 Web Development
This is one man's explanation of how to get your AS400 serving web pages quickly, with the least amount of learning curve, and for free. This is based on months of painful learning experience, so I'm writing this down in the hope that others don't have to go through the pain that I did.
What you will find on this page
What you will not find on this page
Which way forwards for existing applications ?
With the benefit of hindsight, this is easy. For existing applications, leave them alone, and buy some kind of nasty screen scraping tool. There are loads out there, take your pick based on budget etc. There's been free options from IBM from the beginning - eg at V4R5 you had Workstation Gateway, but this was quite nasty and got dropped once the world went to V5 where it was replaced by the web facing tool.
Why am I saying this ? Well, two major reasons. First, cost. It takes a lot of re-engineering to take an RPG program and convert it to Java, or .Net, or whatever. Even if you get an automation tool to do it. Besides that, you need to totally re-test everything afterwards to ensure the business rules have not been broken, which is no mean feat.
The second reason is that web pages follow the CGI methodolgoy, which is a set of standards across both web servers (ie web sites) and web clients (ie browers) for how
information is exchanged between the two. OK, so say you don't want to have to learn Java, but you do want to work from your exisitng apps.
You could stay with RPG and web enable it, which is perfectly acceptable and removes much of your learning curve, but then most interactive applications
simply are not geared around the CGI methodology, they expect that when a screen is displayed the program stays open until it
gets the input and then carries on. With the CGI methodology the client requests information from the server.
The server then sends the information back to the client, but then frees up the program on the server - job done.
Which way forwards for new applications ?
Now this is a whole new kettle of fish. Web and HTML is really good for new applications. Particularly useful for reports, and drill down reports. For example, you get an initial page of summary financial data, let's say by cost centre. You could then click on the cost centre to see by department, then click on department to see individual cost codes, etc. And, for new interactive systems, you can give people a much more familiar interface to use, with drop downs and radio buttons and some nice fluffy images.
So which technology to use ? Again, there are a myriad of ways you can go.
I've heard about NetData for AS400. Tell me more
Well, this is a real interpretive scripting language, similar to PHP or ASP, which is part of the AS400 operating system, even at V5R2M0 and above. This has many advantages. It's built into the OS, free, resides on your AS400, fast to develop in since no compile is required, and flexible. The disadvantages are only two. Most importantly, it's no longer supported on anything but an AS400 - so how long till IBM drop support completely ? The second disadvantage is that since it's interpretive it's much slower than an RPGLE program, for example. For simple examples, and easy reports etc, this really wont matter, but for complex number crunching stuff then it will. I have in the past had to rewrite certain netdata scripts into RPG for performance reasons, and the compiled RPG version run typically 7-10 times faster.
It's certainly worth considering for simple web pages, especially simple reports because the speed to delivery and learning curve is probably the shortest out of all the non-RPG routes. However, you will need to be able to write SQL statements to extract the data off the 400, but since uou are reading this page I'm sure you wont have a problem. IBM has some excellent redbooks on this, so go here for the links I recommend.
Lastly, our friends at ATS have produced a hands-on Net.Data course for AS400, and are the only people to have done so we believe
So how do I write an RPG Web page?
Hold your horses ! Before we jump headlong in to this, some very brief web explanation is required. I'll keep this short, since if you're reading this page you probably know a bit about this kind of stuff anyway.
A web page consists of a big pile of text, delimted by "tags". HTML stands for "hypertext markup language", as you all know, but have you considered what the word "markup" actually means to you ? Well, I'll tell you. It means that the HTML does nothing but layout the page. All you have effectively done is move the presentation layer from being a DSPF showing on a dumb terminal to an HTML page showing in a browser.
So, to be clear on this, you don't actually need a program until you start doing something dynamic, and in your case as an AS400 programmer this means retrieving or storing data from the database. Your traditional "hello world" program in the web world is not actually a program, it's just a pile of text standing in a flat file that you send to the browser. It is static information.
When you come to writing your first web program in RPG (or any other language) you'll soon discover that all you are actually doing is generating HTML text on the fly to be sent to the client. Also, unlike interactive programs running on green screen, you'll effectively be writing one program per screen.
Do I need to buy a good book on this ?
You will notice that there are a number of books on "E-RPG" or "RPG for Web" that you can go and buy. You will also notice that, in particualr, there is
one person whose name you'll see associated with "E-RPG" and this guy has successfully turned himself into the self proclaimed RPG Web Guru. Well, fair play
to the guy, he's made a fair living off the back of it. But, in my humble opinion,
I am now about to explain why you do NOT need any RPG books. This is the important bit on this page. If you take nothing else away, take this.
The important steps are :
The last two steps are easy. The problem you are likely to have is in your brain. You are an AS400 programmer, writing RPG, you can do anything. HTML is, after all, just plain text - not even code ! Surely as a seasoned programmer I can do this ....? Well, yes and no. Yes, you could write an HTML page. Yes, it will display data in the browser. No, it'll look like crap. I mean, it'll look like a green screen converted to a web page, purely because this is what you are used to.
So, realise where your responsibilities lie. Your job is to generate the dynamic parts of the site, to make the right data appear in the right place upon request. Your job is not to design the look and feel of the site. This is simply not your remit, and with good reason - coders and designers are a different breed. So, keep the design of the site and the code that puts dynamic data separate. That is, keep the application layer separate from the presentation layer.
Keeping the code and the base HTML page separate is key to getting a maintainable website under development.
So first off go find a designer. Expectations will be higher. So, grab your designer and get a mock up page done in HTML. Make a note to your designer that they will be
using absolute not relative paths for images etc, since that's what an AS400 uses.
Okay so what about the RPG ?
This bit is easy, and free. Go to Easy400, and download the CGIDEV2 library. Install it on your AS400 and away you go. Want more help ? There is loads on this site. Tutorials, code samples, whole sites, etc, etc. It's a real gem, go visit and learn !
This is, simply put, the best and most useful advice I can give. This set of free libraries from IBM encapsulates all of the functions required into a service program that you simply bind to your RPGLE program. Since your application layer is separated from your presentation layer, the methodology is simple.
Sounds scary ? Shouldn't do. Loading a section of a web page is a single function. Replacing some text with a value is another single function. Sending the resulting HTML back to the client is a single function. Getting a value passed to the AS400 from a web page is, you've guessed it, a single function. So basically with this set of libraries you will have abstracted out the CGI bit into a service program, leaving you to concentrate on the business tasks required by the program.
I realise this sounds totally unglamourous. That's because it is - it's still coding after all !