Brief: Two major AS/400 vendors (IBM and ASNA) have announced plans to release visual development tools for RPG programmers. This article looks at some of the general design principles behind these products and specific plans for each vendor's product.
At present, AS/400 programmers in search of development tools for client/server applications are faced with a dilemma-learn a new programming language or use the PC as a front-end to AS/400 programs by emulating a 5250 data stream. Both approaches have major drawbacks, so I was excited to learn about two upcoming products that address this situation.
o Amalgamated Software of North America (ASNA) has announced a product called Visual RPG which builds on the popularity of Microsoft's Visual Basic product.
o IBM has announced a similar product, IBM AS/400 VRPG Client/2 (VRPG). (At some pre-announce demos the product was billed as Visual Development Environment for RPG.)
Both products should be released by late 1994, although neither company has announced specific dates. Extensive technology previews were shown to attendees at recent trade shows. The IBM and ASNA developers interviewed for this article provided demonstrations and information about their plans.
Programming Principles
If you think visual RPG is an oxymoron, these products will surprise you. Both ASNA's and IBM's products use a point-and-click interface to design the interactive, PC portion of an application. The resulting applications are fully compliant with Windows or OS/2 and include standard graphical user interface (GUI) elements such as scroll bars, buttons for mouse input and list boxes.
These products differ from other PC visual development tools when it's time to create the underlying program logic. A GUI lets the developer focus on the section of code he wants to work on. The big surprise is the code itself- standard RPG code with special op codes to handle GUI events. (See Figures 1 and 2.) As you can see from the illustrations accompanying this article, the RPG code is readily understood by any RPG programmer. The advantage of this should be obvious-although you'll need to learn some new design techniques, you won't need to struggle with new language syntax at the same time.
Both products can potentially be used to develop stand-alone PC applications. Access to AS/400 data is supported directly for op codes such as CHAIN, READ and WRITE. They are not intended for batch processing, although future releases may provide interfaces to host-based batch programs.
The largest issue facing developers who want to use these products is the question of event-driven programming. Central to GUI applications, event-driven programming is based on the idea that the user will control the sequence of screens presented. This is quite different from a traditional AS/400 program which presents a data entry panel and waits for input. The easiest way I've found to understand this is to relate it to the underlying principle of an interrupt.
Almost every computing process is interrupt-driven. For example, your program will continue to process until it needs data from disk. Then it issues an interrupt requesting the necessary data. Conversely, your program may be interrupted because its time slice expires or because a program of higher priority requires CPU resources. In either case, the system software which supports disk access and controls which programs can use the CPU is in a wait state until some event occurs-a disk request, a time-out or some other event. Application programs that use the event-driven model act like the system software-they are in a wait state until some event (initiated by a user rather than another program) interrupts them. For example, a user clicks a mouse button to open a new window.
I believe that as we begin to develop applications using the new visual programming environments, we will discover that event-driven programming is a non-issue. Because the tools are designed to support this style of programming, you will almost be forced to look at your program from the perspective of events. In the demos I saw, the progression from event to action was very natural. I'll take you on a short, guided tour of both products; when the products are released later this year, Midrange Computing will bring you more in-depth coverage.
ASNA's Visual RPG
To develop an application using ASNA's Visual RPG, a programmer begins with a blank form. Think of a form as a panel or, more precisely, a window displayed within the Microsoft Windows environment. The first task involves placing fields, constants and other controls such as graphs in the form. This has similarities to designing a panel using SDA except that fields are placed using a mouse and selected from a tool bar. Controls include items such as scroll bars and input buttons that the user can select using a mouse. The programmer can define specific properties such as colors and fonts for any portion of the form.
The next step is to write RPG subroutines to handle each specific event. For example, when the user clicks on a button labeled "Add Customer," you want to display an input window to collect detailed information about the customer. To build the application, the programmer double clicks on the Add Customer button. Visual RPG presents a portion of RPG code which initially contains only a BEGSR and an ENDSR op code. You can insert code to determine the next available customer number, display a blank customer entry form and provide any default values for the customer.
This process continues for each possible event, with each subroutine being a stand-alone portion of code. Variables can be defined locally for each event without affecting any other part of the application. Other variables and files can be shared by all the subroutines within a form.
Before the entire application can be assembled, you will have to write a small portion of code that defines global files and variables to be used and the initial form to be displayed. This section of code is considered the main program; each form has its own separate subprogram and each event within the form has a separate subroutine.
In most cases, the user will have complete control over the order windows are opened and closed. For example, he can open a customer master list, open three windows with information about specific customers and then open another window to display orders for a fourth customer. Each of the three windows for specific customer information will load a separate copy of the same form. (See 3 for a typical application.)
In most cases, the user will have complete control over the order windows are opened and closed. For example, he can open a customer master list, open three windows with information about specific customers and then open another window to display orders for a fourth customer. Each of the three windows for specific customer information will load a separate copy of the same form. (See Figure 3 for a typical application.)
ASNA hopes that this visual development environment will give programmers the best of two very different worlds. The ability to deliver GUI applications without an immense investment in Windows coding techniques and access to data using familiar RPG/400 op codes.
Visual RPG is stored in free-format and may be edited using any PC editor. The editor supplied with Visual RPG gives programmers a choice between free-format or a spreadsheet-like editor. The latter maintains the fixed format of RPG but lets the programmer set the width of each column. (See 1.) An integrated debugger and migration tools are included in the Visual RPG package.
Visual RPG is stored in free-format and may be edited using any PC editor. The editor supplied with Visual RPG gives programmers a choice between free-format or a spreadsheet-like editor. The latter maintains the fixed format of RPG but lets the programmer set the width of each column. (See Figure 1.) An integrated debugger and migration tools are included in the Visual RPG package.
Visual RPG can take advantage of a number of existing PC products. ASNA's DataGate is included with Visual RPG and provides access to the AS/400 database and other hosts such as Windows NT or UNIX platforms. Programs written in Visual RPG will also be able to take advantage of the vast library of Visual Basic Custom Controls (VBX controls) available from Microsoft and other vendors. VBX controls can be used to add specific functions such as video and audio output to any application. By taking advantage of a recognized standard, ASNA gives Visual RPG programmers immediate access to a broad spectrum of third-party products.
ASNA's Visual RPG is written in C++ and modeled after Microsoft's Visual Basic. ASNA's philosophy is to provide AS/400 programmers with an intuitive interface to event-driven programming.
IBM's VRPG Client/2
The greatest difference between ASNA's Visual RPG and IBM's VRPG is that VRPG is an OS/2 development environment. According to IBM, future versions of VRPG will probably support Windows as a run-time environment, but the first release will not contain this support.
VRPG consists of two components: the GUI builder and the RPG compiler. The RPG compiler is based on AS/400 ILE RPG, due for release later this year. Because all the ILE compilers have a common back-end (see "The Integrated Language Environment," MC, May 1993), the developers were able to use front-end portions of the AS/400 ILE RPG compiler and back-end portions of the OS/2 C++ compiler to implement ILE RPG on the PC.
The VRPG developers also took advantage of other OS/2 products to reduce the amount of new programming required to bring VRPG to market. For example, the editor provided with VRPG is the same editor used for CODE/400, and help screens use standard OS/2 help facilities. The OS/2 Workplace Shell provides functions to control colors, fonts and other screen properties (see 4).
The VRPG developers also took advantage of other OS/2 products to reduce the amount of new programming required to bring VRPG to market. For example, the editor provided with VRPG is the same editor used for CODE/400, and help screens use standard OS/2 help facilities. The OS/2 Workplace Shell provides functions to control colors, fonts and other screen properties (see Figure 4).
VRPG includes built-in communications to support AS/400 database access and several extensions to RPG. For example, the BEGACT and ENDACT op codes are used to mark the beginning and end of a subroutine associated with an event or an action. The %SETATR and %GETATR functions are used to examine and control GUI attributes such as colors and fonts.
In general, the development cycle is similar to any visual development tool and correlates closely with what I've described for ASNA's product. The programmer builds a window using icons and a mouse to place fields, constants and other controls; an RPG subroutine is written for each possible event in the window; and a main program displays the initial window and defines the global files and variables. In most cases, the user has complete control over which windows are open and how many copies of a window are open at a time.
IBM will provide a number of tools to work with applications developed in VRPG. For example, a function browser lets the programmer view the relationships between windows, controls, events and actions (subroutines); an import facility creates a skeleton GUI application based on existing AS/400 applications; and the OS/2 interactive debugger can be used on VRPG programs.
By taking advantage of many existing OS/2 tools, IBM makes it easy to add extensions to VRPG. For example, IBM will provide functions written in C++ for input buttons, scroll bars and other GUI controls. Additional controls could be created by the applications programmer or possibly purchased from other vendors in the future.
Choices for the Future
IBM's VRPG and ASNA's Visual RPG give AS/400 RPG programmers access to GUI development tools without sacrificing their investment in RPG skills. These products deserve serious consideration from any AS/400 shop considering client/server options. At press time, neither company had announced specific delivery dates or pricing but I would expect to see ASNA's and IBM's products on the market by late 1994. Pricing will surely be competitive with other PC- based development tools. Look for more in-depth coverage in future issues of MC.
ASNA: 800-321-2762 IBM: Contact your local representative Sharon Hoffman is the editor of Midrange Computing.
Visual Development Tools for RPG
Figure 1 ASNA's Visual RPG
UNABLE TO REPRODUCE GRAPHICS
Visual Development Tools for RPG
Figure 2 IBM's VRPG Client/2
UNABLE TO REPRODUCE GRAPHICS
Visual Development Tools for RPG
Figure 3 A typical Visual RPG application
UNABLE TO REPRODUCE GRAPHICS
Visual Development Tools for RPG
Figure 4 VRPG gives programmers control of screen propertie
UNABLE TO REPRODUCE GRAPHICS
LATEST COMMENTS
MC Press Online