A Different View of RPG

Take a visual look at RPG with ASNA’s Visual RPG Development Tool

If you are used to RPG in its traditional form, get ready to have your world rocked. Amalgamated Software of North America’s (ASNA, San Antonio, Texas) Visual RPG 3.0 is an innovative product that brings a fresh visual face to RPG, allowing you to leverage your programmers’ existing RPG skills, while at the same time moving forward and keeping pace with the newest technology.

 
Visual RPG Summary

Product: Visual RPG 3.0
Company: Amalgamated Software of North America Inc. (ASNA), 14855 Blanco Road, Suite 300, San Antonio, TX 78216
Phone: 800-289-2762
URL: http://www.asna.com/ (new window)
Price: $6,950 (includes two developer licenses, two weeks of training and five database licenses)
Summary: Visual RPG is a development environment for Windows 95/98/NT that can create GUI applications and ActiveX components using the RPG programming language.

 
During our evaluation we found Visual RPG easy to use, but not without rough edges. Those familiar with Microsoft’s Visual Basic development tool will be most comfortable with the Visual RPG IDE, but even seasoned VB/RPG programmers will have to get used to its quirks.

Visual RPG is not just a development tool, although the Integrated Development Environment is a big part of what you get when you buy it. In addition to the IDE, ASNA includes Accelr8DB, its database system that mimics DB2/400 files. Also, you get Datagate/400, which allows you to connect Visual RPG applications running on Windows 95/98/NT with DB2/400 files.

With Visual RPG and Accelr8DB you can create standalone GUI applications that use RPG for their program logic and access database files in the same manner that an RPG program running on an AS/400 would.

Building a Better (RPG) Application
You can use Visual RPG to port existing RPG applications from the AS/400 to Windows 95/98/NT, but we don’t think that's the best use of the product. ASNA admits that applications ported from the AS/400 may require as much as 50 percent reprogramming to get up and running. This could mean significant programming for large applications. It is not a deal breaker—just something to be aware of.

You can import AS/400 source files (RPG 400 or ILE RPG) and display files into the IDE, but the process of making the imported RPG programs use the imported display files is not automatic. The display file is converted to a GUI equivalent, but you have to write the code that fills the form with data. Certainly, a well-architected AS/400 RPG application will be easier to migrate to Windows, especially one where the business logic is separate from the display logic.

A key feature of Visual RPG is ASNA’s Caviar language, a free-form RPG-like language that Visual Basic and RPG programmers alike will find familiar.
We imported a display file from our AS/400 into Visual RPG and without much trouble got a simple version of the application running. The only thing we noticed about the display process is that the date and time that we added to our display file with SDA came through as label items with default captions, not the date and time. This was easy enough to fix with a little programming, so we don’t see it as a big deal.

The real power of the product is its ability to create GUI applications from scratch that take advantage of all the things you would expect GUI applications to take advantage of. ASNA includes many ActiveX controls specifically tailored to the AS/400 and RPG, such as a subfile control. Also, it has its own set of controls like a combo box or list box control. These controls work, but not in the standard way that the controls you use with Visual Basic work.

For example, the combo box control that comes with Visual RPG does not drop down, it has a place for text entry and a scrolling area of several lines where you can select a specific item that will then be placed in the text area. Because we prefer the standard combo box control with the drop down list, we added that to our tool palette and used it instead of Visual RPG control.

Visual RPG is able to use any standard Windows, or third-party ActiveX control within the Visual RPG IDE. We also tried to use the Windows StatusBar control, but had limited success. We could program the control to work, but the property sheet within the IDE did not work properly. Although the property sheet showed the “Panels” property, it did not allow us to add panels at design time. However, we were able to code the addition of StatusBar panels and use them that way. This isn’t a really big deal, but it would be nice if the tool worked correctly with all of the standard Windows GUI controls.

Placing Objects in a Roe
A key feature of Visual RPG is ASNA’s Caviar language, a free-form RPG-like language that Visual Basic and RPG programmers alike will find familiar. We found ourselves slipping in and out of Caviar, freely mixing fixed-format RPG statements with free-form Caviar statements. This is a very good thing because calling the methods of objects is a little weird in fixed format RPG. Having Caviar to fall back on in these cases was a godsend because the standard object.method syntax that you are used to in Visual Basic works just fine in Caviar.

We feel that most people will want to build Visual RPG applications from the ground up, designing the screens themselves, rather than importing the display files. We also feel that they will want to leverage their existing investment by using the AS/400 as a database server, accessing the data from the Visual RPG application. Although it is possible to create an application that runs entirely on the Windows machine, we feel that using Accelr8DB to connect to your existing AS/400 data is the way to go.

Connecting GUI elements to the database is automatic—point your application to the AS/400 file through a file descriptor just as you would do in a regular RPG program, and name your GUI fields to match the fields in the file. You have to program the reads and writes, but the binding of GUI field to database field is automatic. The file descriptor is slightly different in a Visual RPG application because you have to tell it what the database name is through the DBDESC directive, which is a continuation of the file descriptor. You code the Accelr8DB database name, and then with another continuation, FILEDESC, you code what the file name is.

With Visual RPG, Accelr8DB and Datagate/400 you can create a two-tier client/server application with no trouble. Visual RPG talks to Accelr8DB and Accelr8DB talks to Datagate/400, which in turn accesses the AS/400 files. We setup Datagate/400 in about 10 minutes and using the Form Generation wizard, had a Visual RPG application that accessed data on our AS/400 in another 10 minutes. If you want to store your data on a Windows NT server, that’s all right too—just create an Accelr8DB database on the Windows NT server and point your application to it instead of the AS/400. This is the real power of Accelr8DB—database independence. The same application can access data on a Windows NT server or an AS/400 by just changing the database name. The application does not need to be changed because it is insulated from the actual database implementation.

Web-Enabling Your Applications
If you have written well-architected AS/400 applications then Web-enabling them with Visual RPG will be a snap. When we say well architected, we mean an application that has the presentation logic separate from the business logic. For instance, a well-architected order entry application would have RPG programs for creating an order, creating an order item, processing an order, etc. The presentation logic would call these routines and they could be reused in many places.

If you have written your applications in this manner, it is a simple matter to connect these applications (and your data) to the Web. In addition to using ActiveX components as part of a GUI application, Visual RPG has the ability to create ActiveX components, both visual and non-visual.

When we first spoke to ASNA we weren’t convinced that Visual RPG could be used effectively to connect an AS/400 to the Web, but after closer scrutiny we found that not only does it work, it’s kind of nifty! Not only is it nifty for connecting an AS/400 to the Web, but the same component can be used with any development tool that can use ActiveX components—including Visual RPG itself, or for that matter, Visual Basic.

To test Visual RPG’s capability we first created an AS/400 physical file to hold state income tax information. We entered some fake tax rates that we could access later when we were testing our ActiveX component.

Our next step was to create a new ActiveX DLL project. We then used the wizards to add skeletons for our properties and methods. We added F-specs for our tax file and wrote the code to look up the state and compute the proper tax. Once our code was complete we compiled the class, which created a Windows DLL.

The next step was a little trickier. When we created the DLL file, Visual RPG automatically registered the DLL with the operating system. We searched the Windows registry to find out what name it had registered. We would need this information a few steps later.

This next part will be most foreign to diehard RPG programmers. To test our component, we needed to build an Active Server Pages program to run in Internet Information Server 4.0 (IIS). We wrote the code in VBScript. It is a very simple program. First you instantiate the ActiveX component, then you call the various properties and methods of your component, finally you return the results using HTML.

We wrote the VBScript code, moved the ASP program into the Web server’s root directory and fired up a browser. The nice thing about doing it this way is that the component runs entirely on the server and you don’t have to worry about which browser your visitor is using. We entered the URL of the program, and bingo, the expected results came up.

This is the brute force method for using ActiveX components with IIS 4.0. The preferred method is to put the components into Microsoft Transaction Server, and let it handle the registration. An added bonus effect is that you can tell Transaction Server that a transaction is required and it will handle everything. Plus, when your component runs you can watch the ActiveX bowling ball spin around in the Transaction Server Explorer!

To finish our evaluation of Visual RPG we created another project for a standard GUI application. We added text boxes for the purchase amount and tax, a combo box to choose the state, a button, and a StatusBar. We wrote the code to load the combo box with the state codes and an event handler for the button. This event handler took the state code that we picked in the combo box and the amount from the text box and passed it to the tax component. It then executed the ComputedStateTax method and looked up the correct tax amount from the ComputedTax property and put it into another text box. If the state we picked didn’t have a state tax, we returned a message to the StatusBar stating this.

Once the code was complete we ran our Visual RPG application, entered an amount, chose a state, and pressed the button. After a short wait the tax was computed and displayed in the other text box. While our component executed, we could see its icon spinning in the Transaction Server Explorer.

Visually Appealing
The whole project took all of a couple of hours to complete and most of that time was wasted because we are admittedly novice RPG programmers. After completing this project we could see how these methods could be easily expanded to create a complete Web (or GUI) application using business logic contained in ActiveX components.

Our overall take on Visual RPG is that is a solid product with a few rough edges. We wish there were a way to start the last project you were working on when the IDE started. It would be nice if ASNA added some of the features that Visual Studio 6.0 has such as syntax color-coding and pop-up menus of object methods. These types of features are not essential, but they do contribute to a positive user experience.

If you are looking for a way to connect your AS/400 to the Web, Visual RPG can help you do that as long as you understand that programming is required. If you want to build new RPG applications on the Windows platform, or migrate existing applications from an AS/400, Visual RPG can do that too. In either case, we can recommend Visual RPG to any AS/400 shop that wants to extend the life of RPG and put a visual face on its applications.

Related Editorial:

  • RPG Everywhere!
  • The Future of RPG

    Related Information:

  • Visual RPG 3.0 Overview (new window)
  • Must Read Articles