Logo: TUG TORONTO USERS GROUP for Midrange Systems
e -server magazine

March 1997: Volume 12, Number 4

The AS/400: At Your (Web) Service

By Miles Jenkins

o, have you heard about this thing called the Internet? If you answered No, you might want to grasp your wrist and check for a pulse! In an industry that goes through buzzwords the way that Madonna goes through hairstyles, the Internet - the world-wide "network of networks" - is the current undisputed heavyweight champion. Case tools, client/server, object oriented - they all had their day in the sun, before going to buzzword heaven. Their problem was they just weren't ambitious enough - their benefits were rather technical and limited to the IS Department. The Internet, on the other hand, is being touted as a technology that will do nothing less than change the way we work, shop, learn, and even meet members of the opposite sex. As Saddam Hussein might have put it, if he had majored in Computer Science instead of Ruthless Dictating: "The Internet will be the mother of all paradigm shifts!"

We AS/400 chauvinists usually feel safely cocooned from many of the wilder industry fads that come and go. Our glorious architecture - built-in relational database, integrated security, the 5250 protocol, SNA - has served us well for so many years, and when the Internet bubble has burst (as surely it must), we'll still be running our businesses with those same old unglamourous but dependable features. Right? Well, it is my sad duty to inform my fellow AS/400 bigots that IBM has let us down. They have apparently bought into this Internet thing and have integrated Internet capabilities into the latest versions of OS/400. What's worse - it's free! What's worse still, it is quite easy to set up.

Are TCP/IP, HTML, and HTTP no more than obscure acronyms to you? Well, if you've upgraded your OS/400 level to V3R2 (for CISC models) or V3R7 (for RISC models), and you have an attached PC capable of running the TCP/IP protocol (Windows 95, for example, has native TCP/IP support) and a web browser, you have all you need to delve into the nuts and bolts of serving web pages from the AS/400. Next lunch hour, while your colleagues are off in the lunch room moping about the Leafs, you can dispel some of the technical fog surrounding the Web by configuring your AS/400 as a Web Server.

Here's the drill:

12:00 - 12:05: Excuse yourself gracefully from your lunch clique

Tell your colleagues that you're going to turn the AS/400 into a Web Server over the lunch hour. See them chuckle and shake their heads as they walk away.

12:05 - 12:25: Set up TCP/IP on your AS/400

Any endeavour to deal with the Internet on the technical level has to start with TCP/IP (Transmission Control Protocol/Internet Protocol), the communications protocols that form the backbone of the Internet. Although it is often associated with the Unix world, where it started, TCP/IP has been available on the AS/400 for some time. Today it is a robust, integral part of OS/400, and can co-exist on the same machine with more traditional SNA communications.

There are several applications and utilities whose names may be familiar to you - TELNET, FTP, SMTP, for example - which are dependent on TCP/IP. To serve web pages over the Internet (or an intranet) means, in technical terms, to serve stored HTML (HyperText Markup Language) documents via an HTTP (HyperText Transfer Protocol) server. And the HTTP server is a TCP/IP application or service like the ones mentioned above.

All the TCP/IP configuration and management functions you'll need to perform are conveniently accessible from the TCP/IP Administration menu (GO TCPADM). Option 1 on this menu takes you to the Configure TCP/IP menu. Four options on this menu are all you need to set up your AS/400 to communicate via TCP/IP. Option 1 enables you to add a TCP/IP interface: essentially you are associating an existing line description on your AS/400 with a TCP/IP address (the standard 4-part numeric address: for example and subnet mask (eg. (I can't, in the space of this article, get into all the ramifications of TCP/IP addressing: at the end of the article I'll point you to the appropriate manuals where you'll find more detail). Option 2 lets you define a default route: in other words, if you have an IP router connecting your system to a wide-area network, specifying the IP address of this router will enable the system to hand over to the router any traffic not directed to a system on the local network. Option 12 lets you define a local domain name and host name for your AS/400. The domain name format is familiar to anyone who has worked on the Internet: if, for example, your company name is Acme, and your AS/400 system name is ACME400, your local domain name could be acme400.acme.ca, with your local host name being acme400 - the same as your system name. Finally, using Option 10, associate your numeric TCP/IP address with the host name by adding an entry to the TCP/IP Host Table.

Having configured TCP/IP, you're now ready to start it up. Option 3 on the TCP/IP Administration menu executes the STRTCP command. (You can verify that it is working by taking option 8, and specifying either the IP address or host name for your system). Just two final steps: Option 5 starts one or more TCP/IP application server processes you specify (such as TELNET or FTP). And, before Client Access PCs can access the AS/400 as a host via TCP/IP, the STRHOSTSVR command must be run, to ready the AS/400 to accept connection and signon requests from PCs on the network.

12:25 - 12:30: Create a directory to store your HTML documents

The AS/400 can serve HTML documents from any of its file systems: the traditional library system, a folder in QDLS, a directory in QOpenSys, or its own directory in the root of the integrated file system. For reasons of simplicity and performance, the last option - creating a directory in the root of the integrated file system - may be the best. To create a directory called WEBTEST to contain Web documents is as simple as this:


12:30 - 12:40: Create an HTML "welcome" file

HTML (HyperText Markup Language) is the language universally used to create Web pages, allowing, in addition to straightforward text content, embedded graphics and the links to other pages or other Web sites familiar to anyone who has surfed the Web. There are commercial Web page design programs that allow you to create pages as sophisticated and attractive as you like, embedding all the HTML codes and directives for you, but to create a trivial HTML document to test your AS/400 HTTP server, all you need is an ASCII editor, like Windows Notepad, to enter a document like the following:

<title>Test Document served by the AS/400 HTTP Server</title>
<h1>Welcome to ACME Widgets </h1>
Maker of the world's finest widgets since 1869.

The above will produce the admittedly less-than-dazzling web page seen in the figure below. Note that the <title> line appears in the browser's window title, and that the <h1> line appears as a heading in a large font. Save this file under the name welcome.htm, and copy it to the directory on the AS/400 you created in the last step.  HTML Sample

12:40 - 12:50: Enable the HTTP server

The AS/400 HTTP server job runs under IBM-supplied user profile QTMHHTTP, and you need to ensure that this profile is authorized to the directory and welcome.htm file that you created, with the following commands:


The HTTP server is controlled by a configuration file, which can be edited by entering the WRKHTTPCFG command. The following (case-sensitive) "pass" directive has to be added to this file to allow the "welcome" page to be served:

Pass  /  /WEBTEST/
Welcome welcome.htm

12:50 - 12:55: Start the HTTP server

The HTTP server job is started by the following simple command:


12:55 - 1:00: Call up your welcome file from your Web browser

When you start your Web browser program (Microsoft's Internet Explorer is the example used here) it is probably set to automatically dial out to your service provider. Temporarily disable this dial-out feature and it will allow you to issue a URL (Universal Resource Locator) to a local HTTP server. Give it the name of your AS/400 (using the local domain name and host name you specified when configuring TCP/IP) as follows:


and press Enter. Surf's up! With the rush of adrenalin you get from seeing your web page, you won't even have noticed that you missed lunch!

For more details on setting up TCP/IP and its associated services, such as the HTTP server, the TCP/IP Fastpath Setup manual (SC41-3430) is an excellent guide. The TCP/IP Configuration and Reference manual (SC41-3420) is, of course, more detailed and in-depth, and it covers the HTTP server as well. Also, IBM has a "Web Builder's Workshop" page on the Internet: www.as400.ibm.com/workshop/webbuild.htm T < G