Sun, May
7 New Articles

This Old Search Engine: Configuring and Using the AS/400 Webserver Search Engine

  • Smaller Small Medium Big Bigger
  • Default Helvetica Segoe Georgia Times

One of my favorite TV shows is “This Old House.” OK, I admit it: I’m boring. But I enjoy building things and watching the process take shape. First, you start with the foundation; then, you create the framework; and, finally, you do the finish work. The same analogy applies to Web sites. The first step is to come up with a marketing plan for what kind of site you want. The second step is to build the site. Finally, you are ready for the finish work.

In my view, the finish work is what separates the good Web sites from the not-so- good. With the release of V4R4 of OS/400, IBM provided a great tool for taking your Web site to the next level: the AS/400 Webserver Search Engine. This tool allows you to build a native AS/400 search engine for your site.

I am amazed by the fact that many “professionally” designed Web sites that I run across on a daily basis are extremely hard to navigate. I use the Web to find information quickly. I don’t want to wade through 15 pages to find what I am looking for. This is where the Webserver Search Engine can work to your advantage.


Building the Foundation


Obviously, the first thing you need to do is build a Web site. A search engine isn’t much good without pages to search. One major point to consider, however, is where to put your pages. The Webserver Search Engine does not work with the QDLS file system or Network File System (NFS). (I built an entire site in a folder in the QDLS directory before I discovered this!) Any other AS/400 Integrated File System (AS/400 IFS) directory or QSYS.LIB can be used to store your pages. Because most HTML documents are developed on PCs, however, the AS/400 IFS is probably a better choice than QSYS.LIB. Also, it is important to know that this search engine does not “deep crawl.” What this means is that it does not follow links, so it is important to keep all of the documents that you want to index in one directory. (Subdirectories within the directory you use are indexed.) IBM recommends creating a folder in the root (/) directory of the AS/400 IFS in order to achieve the best performance possible.

The second thing that you want to keep in mind when designing your pages is your “keywords.” When you create your HTML pages, it is important to use the keywords and phrases that you want to be found as many times as possible in both the meta tags and the text of the document itself. The more you use keywords and phrases, the higher relevancy they will have on subsequent searches.


Let’s Take a Minute to Talk About Shop Safety


Another consideration is graphics files such as GIFs and JPGs. These should be stored in a folder different from the one containing your HTML documents. The Webserver Search Engine’s results can be adversely affected if they are indexed. For example, if you have a graphic named as400.gif on every page, the value of the search term “as400” will be lowered.

In the next section, I will cover how to create a search index. It is important to know that this can be a resource-intensive project, depending on the size of your Web site. If you have thousands of pages, you will probably want to create your indexes during off- peak hours to avoid performance degradation.


Time to Pound Some Nails


Once you have a site built, it’s time to start configuring the search engine. The good news is that this is really easy to do. You can do it directly from your browser by simply connecting to http://yourserver.com:2001. You may have to use the STRTCPSVR SERVER(*ADMIN) HTTPSVR(*ADMIN) command to start the server. This connects you to port number 2001 on your AS/400, which is where the HTTP administration server is located. Once you have logged in, select HTTP Server for AS/400/Configuration and Administration/Search Administration. At this point, you are ready to build your search index. To do this, first click on the Create search index link. Figure 1 shows the form that is presented. You will input the following data:

• A name for the index (I called mine “HELPDESK.”)

• The directory where it will be created (I used the default directory.)

• An optional description for the index

Press the Apply button, and you will be prompted to enter the name of the directory that you wish to index (where your Web pages are). Once you enter the directory name, press the Apply button again, and your search index should be created. The newly created index name should appear in the frame on the left-hand side of your screen. It is important to note that you need to re-create indexes from time to time in order to keep the searches current. Until the index is re-created, newly added pages or updated pages will not be reflected in your search results.


On to the Fun Stuff


Now that the grunt work of creating the search index has been completed, it’s time to create the HTML that will be used to do actual searches. Figure 2 contains code that can be used to perform your searches. This is a simple HTML form that you can customize to perform searches that are as basic or complex as you desire. When the Submit button is clicked, a Net.Data macro is executed and returns the search results. The macro that is executed in this example, sample_search.ndm, is provided by IBM. This macro can be customized to return results in any way you desire.

There are 12 elements to the form, some that are required and some that aren’t. Here is a breakdown of what these elements are and how to use them:

• frmIndexName (required)—This is the name of the index that you created earlier.

• frmDir (required)—This is the path name of the directory where your index is located.

• frmMapFile (required)—This file is generated automatically when you generate your search index.

• frmQueryType—This specifies whether the query is “simple” or “advanced.” A simple query searches only for the words listed, while an advanced query allows the use of Boolean operators such as “and,” “or,” and “not.”

• frmStartNum—This option tells the search engine which document to begin with when returning results.

• frmPreference—This specifies whether or not wildcards are allowed.

• frmCaseSensitive—This allows for matching of uppercase or lowercase letters.

• frmStemming—This is a nice feature that enables the search engine to return “fuzzy” matches. If, for example, you do a search for “computerized,” the search engine will return results for “computer,” “computing,” etc.

• frmLogical—This field specifies which logical operator should be used when searching for multiple words.

• frmPrecision—This field regards how “exact” a search will be. A value of 100 means that only exact matches are to be returned. Lowering the precision will return more results.

• frmSearchString—This is a listing of the words that you want to search for.

• frmMaxCount—This is used to indicate the number of matches to return at one time.

Although I have coded most of the form elements as hidden, you can use any or all of them as input fields on your Web page. This provides the flexibility for making searches as simple or complex as you want.


Putting the Fruits of Your Labor to Work


Once you have loaded the search page onto your AS/400, you can begin doing searches. However, in order to effectively use the Webserver Search Engine’s capabilities, you must understand exactly how it performs searches.

The Webserver Search Engine uses the index that you created earlier to search for matches. It uses the index because it is much quicker to search an index than it is to search the actual documents. The index also contains rankings of the documents. An understanding of ranking is important, as it will help you control which documents are ranked highly. Webserver uses the following three criteria to determine the relevancy of a particular document:

• The number of times the terms searched for appear in a particular document

• The position of the search terms in the document (The higher they appear on the page, the greater weight they are given.)

• The number of times the search term appears in the index (“The,” for example, would rank very low, while a less common word such as “palindrome” would rank higher.)

In order to have a page rank highly, you must follow these three criteria. This is easy to do when you control all of the content on your site. It is, however, much more difficult for the big search engines such as Yahoo! If Yahoo!’s rules were this easy to figure out, it would get 10,000 submissions a day using the same technique and the searches would become worthless.

There are a few other tricks to increasing rankings in the Webserver Search Engine that IBM doesn’t mention. The page name, for example, will highly influence relevancy. Another tip is to use alt tags when displaying images. (Alt tags provide the text that displays while an image is loading.) Most search indexes pick up alt text as text; therefore, alt tags provide a good way to influence keyword counts.


It’s Time to Move In


Now that I’ve shown you how to create your own search engine, it’s time to figure out how you can use it for your business. I work for a huge company with over 250 manufacturing facilities worldwide and more AS/400s than I can count. When a problem occurs at plant A, chances are that it will eventually happen at plants B, C, D, etc. as well. Using the AS/400’s Webserver Search Engine and HTTP Server, I was able to build a centralized database for reporting problems and fixes online. Now, instead of spending hours trying to fix a problem that has already been fixed, I check the Web site first. If someone has already figured out a solution, I can generally fix the problem in a matter of minutes.

Well, it’s time to flip on the TV; Norm and Steve are coming on! Be creative, have fun, and we’ll see you next month on the next episode of “This Old Search Engine.”


References and Related Materials


AS/400 Webserver Search Engine Getting Started: www.as400.ibm.com/ tstudio/http/services/searchinfo.htm


This_Old_Search_Engine-_Configuring_and_Using_the_AS-_400...04-00.png 397x297


Figure 1: You will use the Create search index screen to build the index.

Dave Mayle is a senior developer for Eaton Corporation, a global leader in electrical systems and components for power quality, distribution, and control. Dave has worked on the iSeries/System i since 1993 and is currently focused on developing Java, Web, and ILE applications. Dave has written numerous technical articles on the iSeries and is a three-time Speaker of Merit award winner at COMMON. Dave is a graduate of Bucknell University and can be reached at This email address is being protected from spambots. You need JavaScript enabled to view it.


Support MC Press Online

$0.00 Raised:

Book Reviews

Resource Center

  • SB Profound WC 5536 Have you been wondering about Node.js? Our free Node.js Webinar Series takes you from total beginner to creating a fully-functional IBM i Node.js business application. You can find Part 1 here. In Part 2 of our free Node.js Webinar Series, Brian May teaches you the different tooling options available for writing code, debugging, and using Git for version control. Brian will briefly discuss the different tools available, and demonstrate his preferred setup for Node development on IBM i or any platform. Attend this webinar to learn:

  • SB Profound WP 5539More than ever, there is a demand for IT to deliver innovation. Your IBM i has been an essential part of your business operations for years. However, your organization may struggle to maintain the current system and implement new projects. The thousands of customers we've worked with and surveyed state that expectations regarding the digital footprint and vision of the company are not aligned with the current IT environment.

  • SB HelpSystems ROBOT Generic IBM announced the E1080 servers using the latest Power10 processor in September 2021. The most powerful processor from IBM to date, Power10 is designed to handle the demands of doing business in today’s high-tech atmosphere, including running cloud applications, supporting big data, and managing AI workloads. But what does Power10 mean for your data center? In this recorded webinar, IBMers Dan Sundt and Dylan Boday join IBM Power Champion Tom Huntington for a discussion on why Power10 technology is the right strategic investment if you run IBM i, AIX, or Linux. In this action-packed hour, Tom will share trends from the IBM i and AIX user communities while Dan and Dylan dive into the tech specs for key hardware, including:

  • Magic MarkTRY the one package that solves all your document design and printing challenges on all your platforms. Produce bar code labels, electronic forms, ad hoc reports, and RFID tags – without programming! MarkMagic is the only document design and print solution that combines report writing, WYSIWYG label and forms design, and conditional printing in one integrated product. Make sure your data survives when catastrophe hits. Request your trial now!  Request Now.

  • SB HelpSystems ROBOT GenericForms of ransomware has been around for over 30 years, and with more and more organizations suffering attacks each year, it continues to endure. What has made ransomware such a durable threat and what is the best way to combat it? In order to prevent ransomware, organizations must first understand how it works.

  • SB HelpSystems ROBOT GenericIT security is a top priority for businesses around the world, but most IBM i pros don’t know where to begin—and most cybersecurity experts don’t know IBM i. In this session, Robin Tatam explores the business impact of lax IBM i security, the top vulnerabilities putting IBM i at risk, and the steps you can take to protect your organization. If you’re looking to avoid unexpected downtime or corrupted data, you don’t want to miss this session.

  • SB HelpSystems ROBOT GenericCan you trust all of your users all of the time? A typical end user receives 16 malicious emails each month, but only 17 percent of these phishing campaigns are reported to IT. Once an attack is underway, most organizations won’t discover the breach until six months later. A staggering amount of damage can occur in that time. Despite these risks, 93 percent of organizations are leaving their IBM i systems vulnerable to cybercrime. In this on-demand webinar, IBM i security experts Robin Tatam and Sandi Moore will reveal:

  • FORTRA Disaster protection is vital to every business. Yet, it often consists of patched together procedures that are prone to error. From automatic backups to data encryption to media management, Robot automates the routine (yet often complex) tasks of iSeries backup and recovery, saving you time and money and making the process safer and more reliable. Automate your backups with the Robot Backup and Recovery Solution. Key features include:

  • FORTRAManaging messages on your IBM i can be more than a full-time job if you have to do it manually. Messages need a response and resources must be monitored—often over multiple systems and across platforms. How can you be sure you won’t miss important system events? Automate your message center with the Robot Message Management Solution. Key features include:

  • FORTRAThe thought of printing, distributing, and storing iSeries reports manually may reduce you to tears. Paper and labor costs associated with report generation can spiral out of control. Mountains of paper threaten to swamp your files. Robot automates report bursting, distribution, bundling, and archiving, and offers secure, selective online report viewing. Manage your reports with the Robot Report Management Solution. Key features include:

  • FORTRAFor over 30 years, Robot has been a leader in systems management for IBM i. With batch job creation and scheduling at its core, the Robot Job Scheduling Solution reduces the opportunity for human error and helps you maintain service levels, automating even the biggest, most complex runbooks. Manage your job schedule with the Robot Job Scheduling Solution. Key features include:

  • LANSA Business users want new applications now. Market and regulatory pressures require faster application updates and delivery into production. Your IBM i developers may be approaching retirement, and you see no sure way to fill their positions with experienced developers. In addition, you may be caught between maintaining your existing applications and the uncertainty of moving to something new.

  • LANSAWhen it comes to creating your business applications, there are hundreds of coding platforms and programming languages to choose from. These options range from very complex traditional programming languages to Low-Code platforms where sometimes no traditional coding experience is needed. Download our whitepaper, The Power of Writing Code in a Low-Code Solution, and:

  • LANSASupply Chain is becoming increasingly complex and unpredictable. From raw materials for manufacturing to food supply chains, the journey from source to production to delivery to consumers is marred with inefficiencies, manual processes, shortages, recalls, counterfeits, and scandals. In this webinar, we discuss how:

  • The MC Resource Centers bring you the widest selection of white papers, trial software, and on-demand webcasts for you to choose from. >> Review the list of White Papers, Trial Software or On-Demand Webcast at the MC Press Resource Center. >> Add the items to yru Cart and complet he checkout process and submit

  • Profound Logic Have you been wondering about Node.js? Our free Node.js Webinar Series takes you from total beginner to creating a fully-functional IBM i Node.js business application.

  • SB Profound WC 5536Join us for this hour-long webcast that will explore:

  • Fortra IT managers hoping to find new IBM i talent are discovering that the pool of experienced RPG programmers and operators or administrators with intimate knowledge of the operating system and the applications that run on it is small. This begs the question: How will you manage the platform that supports such a big part of your business? This guide offers strategies and software suggestions to help you plan IT staffing and resources and smooth the transition after your AS/400 talent retires. Read on to learn: