One of the more popular technologies in the OS/400 marketplace is commonly referred to as e-RPG, with which you use OS/400 HTTP APIs in an RPG program so that the program can accept standard browser-client input from an HTTP server and return formatted HTML output (including OS/400 data) to a browser client. E-RPG techniques can turn a common RPG IV program into a CGI program that is invoked from an OS/400- based Web site.
E-RPG allows OS/400 programmers to use their native coding skills to integrate business system program logic with their Web sites. The traditional way of using e-RPG involves using your OS/400 V4R3 (or above) machine as both an HTTP server and a CGI server, for delivering RPG output to Web browser clients. Clients pull up an HTML form from an OS/400-based HTTP server instance, fill out the form, and then submit the results to their RPG program through a CGI GET or POST request. The program processes the input against OS/400 data and returns a formatted HTML response to the Web client through the OS/400 HTTP server instance.
This technique is great, but it assumes that youre using your AS/400 as both your primary Web server (for HTML files and forms) and your CGI server (for RPG programs). The e-RPG technology is always presented as a complete solution that totally resides on your AS/400.
But Is This Reality?
The problem is that many companies want to use e-RPG techniques, but they have no intention of using their AS/400s to deliver standard HTML data to browser clients, for two reasons:
They already have an HTML Web server in place.
They dont want to migrate to the HTTP Server for AS/400 or use two different Web servers for basic Web serving.
What these shops want to do is to combine their current Windows-based HTML Web serving environment with the e-RPG technique for integrating OS/400 data with their Web pages. And, since around 20 to 25 percent of all Web sites are running on a Windows Internet Information Server (IIS) platform, the question arises: Can you use e-RPG techniques to interact with your Windows-based Web site?
Yes, you can. Your OS/400 system can function as a CGI-only server, and your e- RPG programs can be called from a Windows IIS server. Its easy and quick.
Heres my road map for setting up an OS/400 CGI-only server that can deliver RPG programs to a Windows IIS server:
1. Set up a new HTTP Server for AS/400 instance on the port of your choice. Dont set up any welcome pages, so that anyone trying to call this instance directly will get an error message. Dont designate any HTML directories for this instance inside OS/400. Be aware, however, that your AS/400 will still have to be Internet-addressable, so this technique doesnt sidestep the security issues of putting your AS/400 on the Internet.
2. Set up your e-RPG structure on your AS/400, complete with a separate library for storing your e-RPG programs. Set your directory and file authorities accordingly.
3. In your HTTP server request routing directives, add only the following directives:
Exec /cgibin/* /QSYS.LIB/CGILIB.LIB/*.PGM
%%EBCDIC/MIXED%%
Fail /*
Cgibin is equal to the URL directory that will be sent from your HTML Form Action clause, and CGILIB is equal to the OS/400 e-RPG program library. The Exec directive translates your users incoming request to the proper location of your OS/400 RPG program and executes it. The %%EBCDIC/MIXED%% clause in the Exec directive handles EBCDIC-ASCII conversion issues between browsers and your HTTP server instance. The Fail directive tells your HTTP server instance to reject any request that isnt intended to execute an RPG program.
4. Instead of using your AS/400 to deliver the HTML form that calls the RPG program in the forms action clause, post your HTML form files and links to your Windows IIS server and modify the action clause in any form tag to call the IP address or domain name of your AS/400 CGI server, along with your cgibin directory name. Heres an example of what your new form tag could look like:
Once you have your HTML forms set up and your RPG programs written, you can use this technique to return output to a Windows IIS server, where it can be combined with other Windows processing solutions, to enhance your Web pages even more. If youre calling the RPG program using the CGI GET method and parameters, change the URL to direct the HTTP request to the IP address or domain name of your OS/400 system. For existing IIS servers, this is a great way to take advantage of the power of RPG.
So, when youre programming using e-RPG techniques, you can easily use this modification to integrate your RPG solutions with Windows IIS and extend this exciting new paradigm to other environments. E-RPG techniques arent just for OS/400-based Web servers. They can be integrated with Windows IIS, too.
LATEST COMMENTS
MC Press Online