28
Sat, Dec
0 New Articles

Using Internet Information Server to Publish AS/400 Data

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

Microsoft Windows NT and Windows 2000 (W2K) come with Internet Information Server (IIS) as a free service built into the operating system. What you might not know is that you can use an NT or W2K server to publish your AS/400 data cheaply and effectively on the Internet or on your company?s intranet. This article will discuss the technologies available for accessing your AS/400 data using IIS and give some example code so that you can see how simple it is to deploy.

 

What Is IIS?

 

The first thing you need to understand is that IIS is built into Windows NT 4.0 and W2K. IIS is tightly integrated with the Windows operating system and operates as a Windows service. The following are some of the neat functions available in IIS:

? Ability to run Active Server Pages (ASP) and JavaServer Pages (JSP) applications

? Ability to access Windows Component Object Model (COM)/ ActiveX Data Object (ADO)

? Integration with Windows security

Some of you may think IIS is not robust enough to serve as a deployment platform for your AS/400 data, but on this point I beg to differ. Let me explain why. Currently, Microsoft has the third-largest and most-visited site on the Internet. The site contains 59 GB of content, serves 5 million visitors a day, and is updated by over 1,000 employees around the world. They update or change from 3 to 7 percent of the content daily, and in December, the Microsoft site had over two billion page views (yes, billion with a ?b?). The interesting thing about this is Microsoft?s site runs on W2K and uses IIS 5.0, which is a pretty good reason for using this technology.

Another positive aspect of using IIS is that it is cheap. You can buy a Pentium III computer with 512 MB of RAM for about $2000 and then add in some cheap PC DASD. At the time of this writing, you can purchase 27 GB drives for around $225. Add a copy of


NT Server 5 user edition for $750 (you only need the base copy, because IIS concurrent Internet connections do not fit into the licensing scheme), and you are ready to serve your users with a high-performance Web server. In fact, you could run IIS from NT workstation, but the server edition gives you a few more operating system features that you may want for future expansion. So, for about $2,700, you have a complete server ready to handle hundreds of simultaneous user requests, whether dynamic requests (ASP and ISAPI requests) or static HTML.

If you grow beyond this hardware, a free download from Microsoft will allow you to do TCP/IP load balancing. This software, Windows NT Load Balancing Service (WLBS), allows you to run multiple NT servers to serve the same content. If a server fails, it will automatically shift the user to another server. You can run up to 32 servers per cluster, and the WLBS software will automatically configure itself based on additions or changes to the states of computers attached to the cluster. You run the software on each computer that is to be part of the cluster, and the best part is there is no need to modify your content to take advantage of clustered server operations.

My last point is price performance. Check out PC Magazine?s review of IIS at www.zdnet.com/pcmag/features/Webserver98/rev4.html to get the skinny. The main thing is that ZDNet found the IIS server to be the fastest HTML server on the market. So let?s review: It?s free with an NT license, it runs on cheap hardware, it supports load balancing, and it performs very well. Enough said. Let?s look at how to make it do something!

 

The Tools of the Trade

 

IIS runs as an NT service, so it can be monitored via the control panel. To configure IIS, you use the Microsoft Management Console (MMC). MMC started shipping with NT option pack 2 and is Microsoft?s strategy for making a universal console for management of Windows services and applications. Vendors write plug-ins that run under the MMC interface, sort of like Operations Navigator. The IIS plugin for MMC gives you graphical access for administering the server and each Web site that the server is serving. You can control site security, FrontPage extensions, indexing, and other properties from this interface.

One of the best features of IIS is its ability to run ASP applications. An ASP is like a normal HTML page, but it has script code embedded into the page. When the server gets a request for the ASP page, the server reads and processes all of the embedded script before sending the page to the client.

ASP scripts can be written in VBScript or JScript. With a third-party product, they can also be written in Perl or REXX. My favorite scripting language is VBScript because it is based on the BASIC language. Anyone can program in VBScript. Heck, it?s BASIC. If you have ever programmed a Word or Excel macro, you?ve used VBScript. Also, Windows 98 and W2K include Windows Scripting Host built into the operating system, so you can write script programs that control or administer operating system services like Active Directory Services and Domain Name System (DNS), or even communicate with the AS/400 from a browser.

ASP scripts, whatever language they?re written in, can access any ActiveX/COM object installed on the NT machine. This capability makes them extremely powerful. They allow you to leverage other people?s objects and code when you are trying to create your site. As an example, I just finished building a site that uses Crystal Reports from ASP pages to generate ad hoc reports and display them in the client browser. The beauty of COM is that I could do this easily by using the Crystal Reports COM properties and methods. For more information on controlling Crystal from ASP pages, see ?Piecing Together the Web-distribution Puzzle,? MC, February 2000.

Other types of COM objects you might want to use to create dynamic content include the Microsoft Word, Excel, Visio, and PowerPoint programs, and even the Microsoft Graph program to create interactive charts. Almost all Windows programs


expose their internal methods and properties through COM, so this gives you a leg up in leveraging existing programs and methodologies in creating your site.

Another component of NT that can be accessed through COM is the CDONTS (Collaboration Data Object for NT Server) object model. This object allows you to send or access mail and public folders on a Microsoft Exchange Server. I have used CDO as part of my ASP scripts under IIS to perform functions like sending reports to users and enabling custom discussion groups within an intranet server. And it?s so easy. Look at the code in Figure 1. This is all the ASP code required to send an Adobe PDF document as a mail attachment to a user?s email account using IIS. There are other features built into IIS and ASP, and I suggest you visit Microsoft?s Windows NT Server Web Services home page (www.microsoft.com/ntserver/Web/ default.asp) for more information about using IIS and ASP features.

 

Getting to DB2/400 and Notes Data

 

The most common use of ASP pages is publishing data contained in databases. The preferred method of getting to the data is ADO (ActiveX Data Object). ADO is an easy-touse programming interface that is positioned on top of OLE DB. ADO allows you to access any data source that has an ODBC or OLE DB provider. Because all commercial databases have ODBC drivers available for the Windows platform, this is my preferred method of communicating with databases.

To communicate with DB2/400, I use either IBM?s AS/400 Client Access Express for Windows ODBC provider or HiT Software?s ODBC provider. Both are mature providers, and they support the free-threaded model of execution. This threading model has the best performance when the site is executing many data-requesting ASP pages at once. If a driver is not free-threaded, NT places the requests in a queue and executes them one at a time. This can be bad for your site?s performance when you get under a heavy load, so you want to avoid drivers that are not free-threaded. Also note that the driver must be able to run as an NT service without interacting with the Windows desktop, because this is how ASP applications execute.

Another data access feature of IIS is connection pooling. Connection pooling allows IIS to keep ODBC connections alive, even after the script has completed execution, so that the connection can be reused by another script. Connection pooling really makes a data-driven site hum. You can enable connection pooling for an ODBC driver by going to the ODBC control panel applet, selecting the Connection Pooling tab, and double-clicking the driver you want to pool. You are allowed to turn pooling on and adjust the time that the connection will be maintained. My site is very active, so I keep my connections alive for 60 seconds. You may need to work with this value to find the optimal settings.

 

Making It Work

 

OK. Enough background information on IIS and ASP. Now we are going to make it do something useful. All AS/400 systems have a library called QSYS2, which contains a file called SYSTABLES. The SYSTABLES file contains an entry for each table and view on your AS/400 system. Figure 2 shows a simple ASP page that will display a list of libraries on your AS/400 system by using IIS. The ASP script itself is very simple; the subtlety is in what it can do. When a client browser requests the script from an ASP-enabled Web server, the server reads the script and performs the following actions specified in the script:

? Create an ADO recordset object

? Log the recordset into an ODBC data source called NAS400

? Execute the SQL command to read a list of libraries


? Format a hyperlink showing the library name for each library returned

? Close the recordset

Voila! There are 28 lines of script, and you displayed a list of your AS/400 libraries in someone?s browser. This script and it?s companion TableList.ASP are available for download from the MC Web site. You could expand them to provide even more functionality, such as displaying columns and relational information about your DB2 database.

 

Put It to the Test

 

ASP is a reliable way to easily build and deploy Web applications. By using COM, you can leverage existing Windows programs and functions to help you create that next killer Web- enabled app. Using ADO allows for high-speed access to existing data on your AS/400. IIS is obviously a robust and feature-rich Web server that is able to run some of the most active sites in the world. I think this technology deserves a test drive.

 

Reference and Related Materials

 

? ?Microsoft Corp.: Microsoft Internet Information Server,? Greg Alwang, PC Magazine Online, May 5, 1998, www.zdnet.com/ pcmag/features/Webserver98/rev4.html
? Microsoft?s Windows NT Server Web Services home page: www.microsoft. com/ntserver/Web/default.asp
? ?Piecing Together the Web-distribution Puzzle,? Michael Cape, MC, February 2000




YourMessage = ?Here is your Attachment?

FromAddr = ?This email address is being protected from spambots. You need JavaScript enabled to view it.?
ToAddr = ?This email address is being protected from spambots. You need JavaScript enabled to view it.?
Set myCDO = Server.CreateObject(?CDONTS.NewMail?)
myCDO.AttachFile ?C:MyPDF.PDF?
myCDO.Send FromAddr, ToAddr, YourMessage
Set myCDO = nothing


Figure 1: Use this code to send PDF documents
via IIS.








Online Database Documentation


Available Libraries


?>




Figure 2: This ASP script will return a list of your AS/400 libraries
as hyperlinks.


BLOG COMMENTS POWERED BY DISQUS

LATEST COMMENTS

Support MC Press Online

$

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: