Merging the Web with your AS/400 to create elegant and professional dynamic web applications has just become a lot easier and a lot less expensive then ever before. Wouldn't it be great if you could pull it all together with the existing development skill set at your organization, quickly and affordably?
Well you can, all you have to do is think smart, ProGen WebSmart!
Read and see how easily:and so much more.
Instead of thinking in terms of having a costly, heavy maintenance Internet presence for the general public that shows static pages, you should be thinking of how you can deliver dynamic information that is already present in abundance on your AS/400 to end users. You can make data available on an internal network (Intranet), or to the outside world (Internet), or to selected users outside your internal network (Extranet). Consider the web browser as a universally compatible ‘thin client’, with no licensing costs. Browsers run on Windows 95/98/NT, Windows 2000, Mac, Unix or NC clients, and behave relatively consistently in terms of data presentation and formatting.
Your IT staff no longer requires a great deal of knowledge to publish live AS/400 data to the web, ProGen WebSmart makes sure of that. The inset box shows a sample of the steps required to configure your AS/400 to serve dynamic web pages, using ProGen WebSmart sample applications.
What are Dynamic Web Pages?
When the web first came into prominence, most commercial sites were nothing more than electronic brochures. You could read about the company, its products, history, etc. but you couldn’t do much else. Now, commercial sites offer dynamic data, delivered from servers. For example, if Amazon gets a new book in stock from Stephen King, they simply update their server database. When customers search for titles by Stephen King, they see the new title. These pages are delivered using CGI (Common Gateway Interface) scripts or ASP (Active Server Pages, Microsoft’s answer to CGI), or by Java servlets.
Dynamic pages are pages that are constructed on-the-fly by a program, instead of being pre-written by hand (‘static’). A program on the server writes real-time generated HTML to the browser. The HTML can include data from any of the server’s accessible databases, interwoven with pre-defined elements, such as links to images, sound files, table definitions, or any HTML element that is supported by a browser.
What Kind of Applications Can I Run with Dynamic Web Pages?
With ProGen WebSmart you can produce almost any kind of application you can imagine using your AS/400 as a web server. For example, you could take any of your existing green-screen applications and web-enable them. Since many of your customers will have access to the Web, you could develop online applications for them that previously required manual intervention. Here are some ideas, with a brief set of features and functions for each one:
(this is a demonstration application, provided with the software)
(this is a demonstration application, available at our web site)
http://esdi.excelsystems.com/webdemo/wdtsk3.pgmProGen WebSmart does not force you into up front data modeling. It will let you use existing AS/400 DDS files and existing relationships. Because of that, you can begin developing programs and applications within the first hour. In addition, you can plug existing non-interactive AS/400 programs and routines directly into ProGen WebSmart created programs letting you extend legacy and third party applications.
Why Use Dynamic HTML and CGI versus Client-side Java?
You have probably heard a great deal about the promise of Java for web-based applications. Java is a great programming language – object-oriented, universally available, easier and safer to program in than C++. So why not write client-side Java code that runs your application instead of using HTML? First, the question is not entirely a fair one, because client-side Java programs communicate in a totally different manner than a browser does with CGI programs. A client-side Java program opens a socket and establishes a state conversation with a server-side program (the server program could be written in any language – RPG IV or Java, for example). This is like a traditional client/server application – both sides of the conversation know what state the other side is in at all times. For example, if the user clicks an Exit button in the client program, the server program can expect to get a message informing it to shutdown both sides of the conversation.
In contrast, a CGI application uses a CGI program as the server, and a browser as the client. The user invokes a function from the CGI program by typing a URL in the browser. The browser communicates with the web server on the host, which in turn invokes the requested CGI program. The program then writes any requested output, consisting of HTML constructed on-the-fly, to the browser. At this point, the CGI program ends, all contact with the browser is lost. The next time the user makes a request for a CGI program to perform some function, that program will have no idea what it did previously. This model of communication is called ‘stateless’ programming, and presents some unique challenges when it comes to writing CGI applications.
At first glance, it would appear that the Java approach is the better one. After all, the client program can keep track of what the server is doing, and vice versa. However, there are some significant downsides to using Java at present:
On the other hand, using server-side CGIs to deliver dynamic HTML pages has the following advantages:
A common objection to CGI program is that the server-side programming can seem complex. ProGen WebSmart addresses this issue by doing the programming for you. We’ll discuss how this works in more detail later, in the section titled
Where ProGen WebSmart comes in.Why the AS/400 is a great Web Server
The AS/400 is shipped with a great Web Server, included free with the base OS/400 operating system software. It includes configuration options that provide OS/400 user-profile level security, so you can restrict access to only certain libraries or objects, just as securely as in a traditional green-screen environment. You can store and access traditional web objects in the IFS directory, including image files, static HTML pages, etc…. We’ve already shown you, in the inset on page 1, how to perform basic configuration to use the Web Server to deliver both static and dynamic pages.
Also, the Web Server is optimized to deliver dynamic pages fast. In fact, many of the performance issues related to running CGI scripts on Unix or NT boxes are just not there on the AS/400. For example, most CGIs on Unix are run using an interpretive script language, Perl. In contrast, on the AS/400, you can use compiled programs, in any high level language. In addition, server jobs are optimized on the AS/400. Normally, whenever a separate instance of a program is invoked by a user through a batch job, or communications job, a new job has to be created. In contrast, HTTP server jobs remain open, waiting to serve program execution requests from clients. This saves the initial startup costs, in time and resources, associated with instantiating (starting) a normal AS/400 job, and greatly increases the speed with which a web page can be delivered. You can configure your web server to have varying numbers of these open jobs available for incoming page requests. This allows you to scale your web site up or down, depending on the traffic volume to your site. You can also configure different instances of the web server, which allows you to control access to your system from browsers by entire groups of people. For example, one instance could server access from the Intranet, and require AS/400 user profile level authority, while another instance could provide access from the Internet, to a completely separate area on your server.
How Delivery of a Dynamic Web Page Works
When a user goes to a URL on your site, the web server decides if it’s supposed to return a static page or call a program. Generally, URLs look like this:
Static pages:
http://192.168.0.128/home.htmlDynamic pages:
http://192.168.0.128/wsdemo/mypgm.pgm(you might have a virtual name, such as
www.bigcompany.com, instead of an IP address).When the web server receives the request for /wsdemo/mypgm.pgm, it resolves this address to a library and program name. You configure the web server to accept this request and perform the appropriate resolution. For example, this statement in the web server configuration:
Exec /wsdemo/* /QSYS.LIB/XL_WEBDEMO.LIB/*
would result in the Web server calling program MYPGM in library XL_WEBDEMO. This program would execute instructions including whatever any AS/400 data access it needs, then send a dynamically constructed page to the user’s browser.
Where ProGen WebSmart Comes In
You can hand-write CGI programs in any high-level language by using the CGI APIs that IBM provides. However, this can be a tedious process, fraught with errors, because translating information from and to the browser is not trivial. Also, the browser can only send alphameric data, so you need to create routines to convert numeric information back and forth to alphameric. Or, you can use ProGen WebSmart to build the programs for you, automatically.
ProGen WebSmart consists of a design tool, that runs on Windows 95/98/NT and Windows 2000, that allows you to drag and drop AS/400 database fields into HTML to construct a working CGI program, written in RPG IV, with no programming required on your part. In fact, you never need to look at the RPG IV generated source code, or know how to code in RPG IV. There is no complex data model to set up, and no work to do using ‘green-screens’. All the design work is done using the ProGen WebSmart PC design tool. Access to the AS/400 database is seamless. You can load file definitions from your AS/400 into a local PC repository that ProGen WebSmart maintains for you automatically. This allows you to design and develop complete applications or programs with full access to your file / field definitions without being connected to the AS/400. The design tool includes a Wizard that guides you through the process of creating a complete working CGI program.
The Wizard leads you through these steps:
To run the generated program, you can simply click the launch button in the design tool, or type in the URL at a web page. You can add links to static pages to call ProGen WebSmart programs, or links from other ProGen WebSmart programs.
About the ProGen WebSmart Web Application Server
The Web Application Server (WAS) consists of a suite of functions embedded in service programs on the AS/400. The WAS differs from other servers, in that it is not constantly running. Instead, a copy of the WAS is bound by reference to each WebSmart generated program, and is only invoked when the program is called by the user via a browser. The WAS contains many of the functions that enable delivery of web pages, and many of the functions described by the WebSmart programming language, PML. For example, the WAS handles functions to publish edited numeric data, which has to be first translated to alphameric, and functions to parse parameters and their corresponding values from incoming URL requests. The WAS also contains performance optimization routines, to maximize the speed with which data is transmitted to a web page. Some of the other capabilities of the WAS include graphic creation and manipulation capabilties as well as search engine capabilities.
Periodically, the WAS is upgraded, either to add new functions to it, or to fix reported bugs. We have designed WebSmart so that you can always install upgraded versions of the WAS without affecting existing programs. If you need new features of the WAS in an existing program, you can open the program definition in the design tool and regenerate the program. Regenerating will cause the program to use the latest installed version of the Server located on your AS/400.
How ProGen WebSmart Templates Work
ProGen WebSmart templates are PC text files that contain all the information needed to construct a working ProGen WebSmart program using the design tool. The product is shipped with several pre-built templates, and more are made available routinely at our web site,
www.excelsystems.com/progenwebsmart.htmThe template contains information that is used by the design Wizard. This information includes instructions on how the Wizard should behave, in order to guide you through the appropriate steps to construct a working program. For example, some templates are designed to produce a list of database records in a table. They contain instructions to prompt you for fields to select to appear in those lists.
The templates also contain preliminary HTML that is used for constructing the pages to be delivered by the generated program. The provision of preliminary HTML means you can start generating working dynamic pages immediately, without requiring any knowledge of coding HTML at all. As you become familiar with the software, and with HTML in general, you can start expanding your horizons, and adding more features to your pages.
The templates also contain the necessary instructions that get translated into RPG IV code in the generated server program, to control the logic of the program. These instructions are written in an easy to learn language, called PML. The section below titled
What About Extending The Program Logic? explains PML in more detail.How ProGen WebSmart Stores Your Design Work
The design process starts with the selection of a template, and finishes with the production of a text file that contains all your design work. This is referred to as a ProGen WebSmart Definition. The definition contains all the information required to construct a working CGI program using the WebSmart generator. It stores such items as the HTML segments, the program logic, information regarding database files, fields, program source file and object library, etc…. Because definitions are contained in standalone PC text files, you can easily share them with other users, or on other computers you may be working on. You can e-mail them, copy them to network drives, etc.
The two major components of a WebSmart definition are the HTML segments and the programming logic, which is written in PML. The next sections discuss these components in more detail.
How To Customize the HTML in ProGen WebSmart
While ProGen WebSmart takes you through the entire design process without you having to write a line of HTML or code, you will sometimes need to extend the functionality of the generated program – either its look and feel (the HTML) or its function. You can think of working with HTML in ProGen WebSmart as analogous to using SDA on the AS/400 to design display files. With SDA, you can place constants and set their colors, etc…. You can also place fields from database files. Comparably, ProGen WebSmart lets you write the HTML, or design it with the fully integrated WYSIWYG HTML design tool. (Or, you can write HTML using any one of a plethora of available products.) You integrate AS/400 data simply by dragging and dropping fields onto the HTML.
Here’s a snippet of HTML with AS/400 data integrated:
<TR
bgcolor=<field name=*PGMFLDS.pgmf_altrowclr>><td
><a href="ITMMNT50.pgm?TASK=inq&rrn=<field name=*WRKFLDS.rrn>">Display</a> <a href="ITMMNT50.pgm?TASK=beginchg&rrn=<field name=*WRKFLDS.rrn>">Change</a> <a href="ITMMNT50.pgm?TASK=del&rrn=<field name=*WRKFLDS.rrn>">Delete</a></td><TD
width="60" ><field name=ITEMMST.IITEM#></td><TD
width="250" ><field name=ITEMMST.IIDESC></td><TD
width="50" ><field name=ITEMMST.IIUNTP editcode=J></td><TD
width="80" ><field name=ITEMMST.IENTMM editword="' / / '"></td><TD
width="30" ><field name=ITEMMST.IWHSE></td></TR>
The fragments marked <FIELD NAME= … > represent placeholders for the AS/400 data. At runtime, actual data from your file fields is written to these place holders. This snippet shows a row in a table (comparable to a subfile) for an Item Maintenance program. The edit code on IIUNTP and edit word on the date field were added by simply right-clicking on the field names in the design tool.
Notice that the HTML is color-coded. This is a feature of ProGen WebSmart designed to make reading and writing HTML easier for you. Another tool for assisting with HTML construction include a Preview feature, which allows you to combine segments of HTML into Previews, and see the results in a mock-up page, rendered in your browser.
ProGen WebSmart also has a feature called ‘HTML snippets’ for helping you to construct pages quickly. This feature allows you to collect fragments of HTML and assign names to those fragments. For example, you might have a company logo that is stored as an image file somewhere on the AS/400 IFS. You could write a piece of HTML code that displays that image on a page, and also has a link to your corporate home page embedded with it. You can name these snippets, and they appear in a list in the bottom left-hand corner of the design tool while you are working with HTML code.
Here’s a snippet we sometimes use when writing WebSmart programs for our own use. This one is called "Powered by WebSmart logo". The HTML code is:
<A
HREF="http://www.excelsystems.com/websmartspt.html"><IMG
SRC="/websmart/images/PWSAni.gif" WIDTH="220" HEIGHT="42" ALIGN="TOP" ALT="ProGen WebSmart (tm) Produced by ESDI" BORDER="0"></A>This example places an animated image (PWSAni.gif) on the page, and allows the user to click on the image to go to the WebSmart product page on our web site.
To place this code in the HTML, you simply drag and drop its description at the desired location in the HTML. The design tool then inserts the code you see above.
ProGen WebSmart comes pre-loaded with a set of useful snippets. You can add your own, or change or delete any of them. Also, you can share snippets with other users, by emailing them or storing them in a common file on your network.
What About Extending the Program Logic?
ProGen WebSmart comes with a powerful programming language, called PML. The syntax is similar to C or Java, and includes many traditional AS/400 programming constructs for record-level database access.
Here is the complete code for a program that lists a set of records from a file. Note that, in this example, none of this
code had to be written by hand – it was all built automatically from the template and through the Design Wizard:
It is beyond the scope of this white paper to go into too much detail on the syntax of the code shown here. Instead, here’s a brief explanation of the logic flow:
Here’s the page that is produced from this program. It uses a warehouse file, which has 2 fields: location ID and warehouse name. Below the page, we’ve included the HTML that is a part of the definition that produced the page.

As mentioned earlier, the HTML used in a generated program is stored along with the PML, and other information, in a text file called a ProGen WebSmart Definition file. HTML is defined in segments, to make it easy for you to construct various components of a page in your programs. The example above uses 3 standard segments that are included in the template that was chosen to produce this program.
Note that, in order to produce this program, we did not have to write a single character of HTML by hand.
It was produced from HTML already in the template combined with HTML constructed automatically by the Design Wizard as we went through the initial design steps.
The 3 segments used are:
<html><head><META
HTTP-EQUIV="Pragma" CONTENT="no-cache"><title>
Warehouse Listing</title><style
type="text/css"><!--
TD {font-family:Arial; font-size:10pt}
--
></style>
</head><body
><p><CENTER><IMG
SRC="/pftw/images/samplogo.gif" ALIGN="TOP" BORDER="0"><br>
<h1><FONT
FACE="arial,helvetica">Warehouse Listing</font></h1><TABLE
BORDER=0 width=95%><tr
bgcolor='#ccccff'><td
width="10%">Location ID</td><td
width="90%">Warehouse Name</td></tr>
<TR
bgcolor=<field name=*PGMFLDS.pgmf_altrowclr>><TD
width="10%"><field name=WHSEMST.WWHSE></td><TD
width=90%><field name=WHSEMST.WWDESC></td></TR>
</table></center></body></html>
If you find the appearance of PML a little daunting at first, don’t worry. It’s quite easy to learn, once you adjust to a couple of syntax requirements. Also, we have provided many tools in the product that assist you in programming. These are:
Some of the features it supports are:
PML is flexible and extensible: PML functions can be simple or complex, and due to its rich vocabulary, you can do almost anything you want in it. In addition, you can create your own custom PML functions, and include them in the design tool for use by yourself or others. For example, we have included a function called COUNTRYBX that displays a list of countries in a drop-down box and allows the user to select one, much like you see on any number of commercial web sites. When creating this function, we came up with a list of countries (and abbreviations for each one) that suited our needs. However, you may want to expand or shorten the list, or change the abbreviations to match codes you have in a file. In order to accommodate this possibility, we provide you with the RPG IV source code that is used by this PML function, so you can modify the function to suit your requirements. You can also create your own functions, and modify the code generator on the AS/400 side to generate the appropriate RPG IV code to run your functions as desired.
PML is a constantly evolving language. As new releases of WebSmart are made available (either "point" releases, or full upgrades), new functions will be added to the language. Also, we have designed PML to be platform-independent, which means that it is possible for us to write a generator that produces Java servlets, enabling WebSmart to run on platforms other than AS/400.
Why You Should Choose ProGen WebSmart
Here are some of the options available to you for delivering live AS/400 data in web browsers:
Here’s why ProGen WebSmart is a better alternative than any of these options:
So go ahead
and think smart, Think ProGen WebSmart !To try ProGen WebSmart call BCD or your authorized BCD reseller and
you will soon see why this is the Smart choice for you.
Business Computer Design Int'l, Inc.
- 630-986-0800 - www.BCDsoftware.comProGen WebSmart and ProGen Plus are TM's of ESDI, all other TM's are TM's of their respective owners. © 2000 BCDI