Weve all seen or heard about the hamburger-flipping scenario awaiting RPG programmers who have yet to learn Java. It gets you believing that your AS/400 skill set is valueless with respect to the Web unless you stop today and change direction quickly. Well, you can relax. You are valuable, and there is an alternative much simpler than Java for getting your AS/400 shop up and running on the Internet.
A Little History
Years before client/server first arrived on the scene, there was the green-screen and its corresponding 5250 data stream. The green-screen allowed users to type into fields, press Enter, and have data sent to a corresponding RPG program for processing. After going through a series of validation routines (hopefully), either the same screen would appear with an error message, or the next screen in the process would be presented to users. The beauty of this central host architecture was that screen presentation, logic, and data were all controlled on a single platform.
With the advent of the client/server model, the centralized architecture that had served users so well was soon considered archaic and rudimentary. The distributed architecture model that replaced it allowed data and applications to be separated from the host for local processing. The fact that databases around the world would be out of sync didnt seem to bother anyone at the time: The new programming paradigm had arrived, and it was the way application development would be done from that point forward.
Back to the Future
While on the road to client/server architecture, a little something called the Internet showed up and quickly changed everything (well, maybe not everything). Have you ever noticed that, when you receive a page via the Web, you type into fields and click Submit and your data is sent to a program for processing? Sound familiar? It should. If youve written RPG code on the AS/400, you will immediately recognize the similarities.
The Web has brought us back to a modified version of the central host architecture we are so accustomed to. This architecture is somewhat different in that it attempts to logically separate the three tiers: presentation, logic, and database. However, application
programs and data typically reside, as they should, on the same machine or in close proximity for efficiency. Because the Internet uses this model, you have a tremendous advantage in being an AS/400 RPG programmer: You already understand it. Youve been working with it for as long as youve been working with RPG, and this is only one of the reasons your skill set is still valuable today.
The second and arguably most important reason you are still valuable is that you know how to process data once you receive it in your program. Youve been writing manufacturing, distribution, inventory, and accounting applications for years; this alone should get your companys attention as it decides to move to the Web. Now, you may reasonably maintain that the only language you are familiar with is RPG and that you and your company dont have the time or inclination to learn Java. Therefore, it would be simple to conclude that you dont know how to process this Web-based data, and, until recently, you would have been correct.
A Diamond in the Rough
Enter ASNA Visual RPG (AVR) and, along with it, the third reason for your value. AVR is a Windows-based programming development environment that allows you to use your existing RPG skill set to create components that act as the interface between the Web and your AS/400. These programs are capable of receiving input directly from Web-based HTML screens, communicating with the AS/400 database and programs directly, and returning data to the browser.
As an RPG programmer, you now have an avenue to use your business know-how and programming experience and redirect it to the Web. This alone will not make you an Internet expert, but you are about to see how coupling your skills with those of an HTML and Active Server Pages (ASP) programmer will have you developing Internet-based applications faster than you can say Java.
Heres How Its Done
Microsoft has created a standard called Component Object Model/Distributed Component Object Model (COM/DCOM). COM is nothing more than a set of rules that define how programs (objects), including programs that have been written using different languages, communicate with one another. This is similar to having a CL program call an RPG program with parameters. As long as the specific interface is adhered to, the programs can call one another seamlessly.
Now, imagine that the CL program could call a subroutine of the RPG program and pass it parameters directly. Imagine that the RPG program could then share its variables with the calling program simply by defining them as *Public. If you understand this concept, you can begin to appreciate the true power of COM. Using AVR, todays RPG programmer can write code to create COM-compliant objects. AVR handles this layer of complexity for you automatically by compiling your RPG code into a Dynamic Link Library (DLL). Once its in this format, your programs can be recognized by and interfaced with Web-based programming languages such as Microsofts ASP. You can now begin to see how AVR, which directly accesses AS/400 programs and files, can act as the bridge between the Internet and your legacy applications.
Lets Talk Details
There is no question that some effort is required on the part of the programmer to learn how the Internet itself works. Understanding the interaction that takes place between Web browsers and Web servers is perhaps the most important aspect. The browser is a program that has the ability to request a Web page from a Web server. The server has the ability to find the requested page and send it immediately to the browser, which, in turn, displays it to the user. In this example, the Web server is the Windows NT Internet Information Server (IIS).
Figure 1 shows a simple Web-based data entry screen that accepts name and address information. My objective is to have data written to an AS/400 database file when the Submit button is clicked. Notice that the file requested in the URL has extension .asp. This file has significance for the Web server. Rather than downloading the file to the browser immediately, the server processes the file one line at a time. Whenever it finds HTML, it sends it directly to the browser, and whenever it finds ASP code, it allows that code to execute.
Figure 2 shows two ASP subroutines used to get HTML input fields to your RPG program. First, in subroutine GetFormInfo, the ASP request method is implemented to extract the values of the HTML input fields. Once obtained, these values are moved into fields (properties) that ASP and RPG share. This is done in subroutine AddUser. To make the connection to the RPG subroutine, ASP instantiates the AVR object with the Server.CreateObject method. This simple statement is what gives ASP the ability to directly reference all publicly declared subroutines and properties associated with the newly created object. Figure 3 shows how the RPG subroutine AddNew simply uses these fields normally to populate the AS/400 database after ASP calls it.
What I have essentially done in this example is separate the screen presentation (browser) from the business logic (RPG) and the database (DB2 UDB). This is the objective of three-tier, Web-based programming, and it was all accomplished without a single line of Java code.
Use Your Skill Set to Create Alternatives
Your RPG skill set is a valuable commodity when preparing your company to go to the Web and should not be underestimated. With a basic understanding of the Internet and a well-versed ASP programmer at your side, you can be well on your way to producing AS/400-based Web applications for your organization that you will be proud of and that your company will undoubtedly benefit from. Taking the time to understand this mechanismalthough, initially, it may be a bit confusing if you are a sheltered RPG programmermay be your best opportunity to advance to the Web and avoid being relegated to the green-screen with the rest of the pack.
This should also pique the interest of upper management. Given todays volatile employment environment, any opportunity to retain valued programmers is worth its weight in gold. To accomplish this by simply enhancing a programmers abilities rather than rehiring and starting over is invaluable. Whether you are a manager or a coder (or both), do not sell yourself short when considering current skill sets because your future and your companys future is in the AS/400 Web world.
Figure 1: Here is an HTML input screen whose field values will be passed to an RPG program via ASP upon clicking Submit.
Figure 2: Getting HTML input fields to your RPG program is a two-step process for ASP.
Figure 3: The RPG subroutine AddNew uses the fields to populate the AS/400 database.
LATEST COMMENTS
MC Press Online