Getting Control of Host Servers

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

OS/400’s host servers act as the back-end service for AS/400 Client Access Express for Windows. This set of server programs controls functions such as ODBC and OLE database access and password verification for Client Access Express components. The host servers communicate with Client Access Express via TCP/IP Sockets. Sockets are a means of client/server communication that allow applications to send and receive data over TCP/IP networks. A port number assigned to the server application is contacted from the client application and used to send data to and from that application.

You can compare this process to your office telephone system. Think of your AS/400’s IP address as the office phone number and the port number as the extension number to get to a specific office. When the client “calls” the AS/400, it asks for a specific extension. When that extension (or the server program) answers, meaningful communications begin. The process of communicating over a Socket begins when the client application requests a connection with the server port. The server daemon job is waiting, or “listening,” for this type of request and subsequently initiates the server job. At that point, the client application is able to communicate with the server job and send data back and forth. I will examine the function of each of the host servers.

The Host Servers

There are nine host servers, each of which controls a certain task on the server side. Figure 1 shows the host server jobs and the functions that they control.

The file server, which is used in place of shared folder functionality, is used for accessing any of the file systems supported by the AS/400. These include the QfileSvr.400 file system, which provides access to the AS/400 Integrated File System (AS/400 IFS) on remote AS/400s. Also supported is the QNTC files system, which provides access to Microsoft Windows NT files on either an Integrated Netfinity Server for AS/400 (INS) or other NT network. There is also the QLANSrv file system supports OS/2. The QOpenSys file system, which is designed to be compatible with UNIX standards, is also supported. The QOPT file system allows access to CD-ROM drives and other optical media attached directly to the AS/400 and all the other common AS/400 IFS file systems you’ve become familiar with.


The database server handles all data communications including ODBC, data transfer, and OLE DB access, to name just a few. Control of this server can be useful in situations where you wish to disable ODBC or OLE DB access to your AS/400 database. To disable ODBC or OLE DB, you would simply end the database host server, and then all remote database access would be unable to function.

The print server allows for network printing through the AS/400 in the same way that virtual printing did under older versions of Client Access (or PC Support), only with greater print management functionality. Although virtual printing did allow printing of PC documents on AS/400 printers, it didn’t allow the user to control the AS400 printer queues the same way you would control a PC or network printer queue. The network print server function does. This means that AS/400 printers are more easily and invisibly integrated into the client workstation.

The data queue server allows PC client applications to have access to AS/400 data queues as well as provides portions of the OLE DB functionality.

The remote command and program call server allows PC client applications to call programs and run commands on the AS/400 and return values to the client application. The remote command and program call server is also used by the OLE DB provider when remote commands are requested by the client application.

The central server is used for client management including license management for Client Access functions like PC5250 and data transfer, which require client licenses. The signon server is used for password management functions for jobs communicating via host servers and is also used to change passwords via Client Access.

The server mapper allows a client to find the port for a particular server job. The server daemon jobs handle the initial communication with the client and starting of the server job when a client request is issued. For example, when an application requires an ODBC connection to an AS/400 database file, the Client Access ODBC driver initiates the communication that is received by the Database Server daemon (QZDASRVSD). The Database Server daemon then submits the Database Server prestart job (QZDASOINIT), which actually returns the records to the Client Access ODBC driver. One instance of the QZDASOINIT prestart job will be started for each client requesting a connection. In this example, each Client Access ODBC connection will have an instance of QZDASOINIT.

These are the AS/400 host servers. Generally, you would control these servers via the Client Access Operations Navigator (OpsNav) GUI. What happens if you are not on a PC but you still need access to the host servers? If you don’t have a PC to run to, or if none of the PCs at your location have OpsNav on them, then you’ve got a problem. Or do you?

Controlling the Servers

The green-screen interfaces to the host servers are the Start Host Server (STRHOSTSVR) and End Host Server (ENDHOSTSVR) commands. STRHOSTSVR accepts two parameters; SERVER, the server type (*CENTRAL, *DATABASE, *DTAQ, *FILE, *NETPRT, *RMTCMD, *SIGNON, *SRVMAP, or *ALL), and RQDPCL, the required protocol (*ANY, *TCP, or *IPX). The ENDHOSTSVR command only supports the server type (SERVER) parameter. While these two commands do allow you to start and stop any or all of the host servers, that’s pretty much all they do. And although you can view host server status information from OpsNav, there really hasn’t been a good green- screen option to do the same, until now.

WRKHOSTSVR Command

The Work with Host Servers (WRKHOSTSVR) screen shown in Figure 2 (page 88) acts as a control panel for the host server jobs. Not only can you view the current status of all of the servers, but you can also start or stop them as well as work with the server daemon job from one screen. Remember that the server daemon job is the backbone of each of the host


servers. These jobs are responsible for the Socket communication and “listen” on the required port for connect requests from a client application. You can use WRKHOSTSVR to easily control your AS/400’s host servers from a green-screen.

The RPG IV program, WHSR1, shown in Figure 3 (page 89) along with display file WHSFM (available for download along with all the other code for this utility from the MC downloadable code Web page at www.midrangecomputing.com/mc) are the guts of the WRKHOSTSVR command. WHSR1 will check the status of each of the server daemon jobs, display this status, and allow the user to start and stop the servers or to work with the daemon job using the Work with Active Job (WRKACTJOB) command.

This program uses the CHKSVRPGM CL program (included with the downloadable code) to check the status of each server daemon job. This is done by doing an Allocate Object (ALCOBJ) command on the server daemon program for each server. If the program is running, it cannot be allocated, so the message CPF1002 is returned to the CL program, and the status is *ACTIVE. If the program is not running, the object is allocated and de-allocated immediately, and the status is *INACTIV.

The WHSR1 program can start and end a selected server by placing 1 (start) or 4 (end) in the option field next to the server name. Placing a 5 in the option field causes WRKACTJOB to be displayed for both the serve daemon jobs and the server jobs themselves for the selected host server. This means that you can view all of the jobs related to a specific host server on one screen without having to search through a subsystem. In the case of the database server, this allows you to view all instances of the QZDASOINIT prestart job and see who is currently doing remote data access. This can be a big help in resolving record-locking issues.

The final two components of the Work with Host Servers command are the CL program WHSC1, which is the Command Processing Program for WRKHOSTSVR and is used to call WHSR1, and the WRKHOSTSVR command source. The WRKHOSTSVR command accepts only the SERVER parameter, which is identical to the SERVER parameter on the STRHOSTSVR or ENDHOSTSVR command. Once you’ve compiled all of the objects, type WRKHOSTSVR to display the Work with Host Servers screen.

Being a Polite Host

Getting a handle on your host servers can be a big help in resolving issues with client-to- AS/400 applications, and using the WRKHOSTSVR command is a big step on the way to making sure that your AS/400 is a polite host.

REFERENCES AND RELATED MATERIALS

• AS/400 Work Management (SC41-5306-03)
• Client Access Express for Windows Host Servers (SC41-5740-03)

The Code


Host Server Functions Performed

Database Server Database access APIs (SQL, ODBC APIs), data transfer, OLE DB provider
File Server Network drives
Data Queue Server Data queue APIs (also some OLE DB functions) Remote Command Server Remote command functions, distributed program calls, and OLE DB remote command functions
Network Print Server Network (virtual) printing and control Central Server License management, conversion maps Signon Server Client password validation
Server Mapper Handles mapping of socket ports

Figure 1: This table shows all of the host servers and the functions they perform.

Getting_Control_of_Host_Servers04-00.png 400x290

Figure 2: Use WRKHOSTSVR to control host server functions.

**************************************************************

* Program: WHSR1

*

* To Compile:

* CRTBNDRPG(xxx/WHSR1) SRCFILE(xxx/QRPGLESRC) +

* SRCMBR(WHSR1)

***************************************************************

FWHSFM CF E WORKSTN

F SFILE(WHSSFL:RRN)

D EOFDS S LIKE(*INLR)

D ReDis S LIKE(*INLR)

D RRN S 4 0

D JobStat S 10 DIM(8)

D JOBS S 71 DIM(8) CTDATA PERRCD(1)

D JOB DS 71

DJobName 1 9

DJobLib 11 20

DJobPrg 21 30


DJobSbs 31 40

DJobDesc 41 65

DJobWldc 66 71

C*

C *ENTRY PList

C Parm SERVER 10

C ReDspl Tag

C Do 8 X 2 0

C MoveA JOBS(X) JOB

C Call ‘CHKSVRPGM’ 99

C Parm JobLib

C Parm JobPrg

C Parm JobSts

C If Server=’*ALL’ or Server=JobName Or

C JobSts=Server

C Eval JobStat(X)=JobSts

C EndIf

C EndDo

C*

C DoW *INKC=*Off AND*INKL=*Off

C If *IN42=*Off

C Eval *IN50=*OFF

C Eval RRN=0

C Write WHSHDR

C Write WHSSFLC

C*

C Do 8 X 2 0

C MoveA JOBS(X) JOB

C If Server=’*ALL’ or Server=JobName or

C JobStat(X)=Server

C Eval JobSts=JobStat(X)

C Eval RRN=RRN+1

C Eval *IN60=*Off

C Write WHSSFL

C EndIf

C EndDo

C EndIf

C Eval *IN50=*ON

C If RRN=0

C Clear JOB

C Clear JobSts

C Eval *IN60=*ON

C Eval JobDesc=’* No Matching Jobs Found’

C Eval RRN=RRN+1

C Write WHSSFL

C EndIf

C If RRN>0

C ExFmt WHSSFLC

C Eval *IN42=*OFF

C If *INKE

C Goto ReDspl

C EndIf

C Eval EOFDS=*OFF

C Eval ReDis=*OFF

C DoW EOFDS=*Off

C ReadC WHSSFL

C Eval EOFDS=%EOF(WHSFM)

C If EOFDS=*Off

C Select

C When OPT=’1’

C If JobSts=’*ACTIVE’

C Eval *IN41=*ON

C Eval *IN42=*ON

C Update WHSSFL

C Eval *IN41=*OFF

C Iter

C EndIf

C Eval ReDis=*On

C Eval CMD=’STRHOSTSVR SERVER(‘+JobName+’)’

C If *INKD=*ON

C Eval CMD=’? STRHOSTSVR ?*SERVER(‘+JobName+’)’

C EndIf

C Call ‘CLQCMD’

C Parm CMD 45

C Parm 35 LEN 15 5

C When OPT=’4’

C If JobSts=’*INACTIVE’

C Eval *IN41=*ON

C Eval *IN42=*ON

C Update WHSSFL

C Eval *IN41=*OFF

C Iter

C EndIf

C Eval ReDis=*On

C Eval CMD=’ENDHOSTSVR SERVER(‘+JobName+’)’

C If *INKD=*ON

C Eval CMD=’? ENDHOSTSVR ?*SERVER(‘+JobName+’)’

C EndIf

C Call ‘CLQCMD’

C Parm CMD 45

C Parm 35 LEN 15 5

C When OPT=’5’


C If JobSts=’*INACTIVE’

C Eval *IN41=*ON

C Eval *IN42=*ON

C Update WHSSFL

C Eval *IN41=*OFF

C Iter

C EndIf

C Eval ReDis=*On

C Eval CMD=’WRKACTJOB JOB(‘+JobWldc+’)’

C Call ‘CLQCMD’

C Parm CMD 45

C Parm 35 LEN 15 5

C EndSl

C Clear OPT

C Update WHSSFL

C EndIf

C EndDo

C If ReDis

C Goto Redspl

C EndIf

C EndIf

C EndDo

C Eval *INLR=*ON

C Return
** Host Server Jobs
*CENTRAL QIWS QZSCSRVSD QSYSWRK Central Server QZSCS*
*DATABASE QIWS QZDASRVSD QSERVER Database Server QZDAS*
*DTAQ QIWS QZHQSRVD QSYSWRK Data Queue Server QZHQS*
*FILE QSYS QPWFSERVSDQSERVER File Server QPWFS*
*NETPRT QIWS QNPSERVD QSYSWRK Network Print Server QNPSE*
*RMTCMD QIWS QZRCSRVSD QSYSWRK Remote Command Server QZRCS*
*SIGNON QIWS QZSOSGND QSYSWRK Signon Server QZSOS*
*SRVMAP QIWS QZSOSMAPD QSYSWRK Server Mapper QZSOS*

Figure 3: The RPG IV WHSR1 program gives you green-screen access to the AS/400 host servers.


Mike Faust

Mike Faust is a senior consultant/analyst for Retail Technologies Corporation in Orlando, Florida. Mike is also the author of the books Active Server Pages Primer, The iSeries and AS/400 Programmer's Guide to Cool Things, JavaScript for the Business Developer, and SQL Built-in Functions and Stored Procedures. You can contact Mike at This email address is being protected from spambots. You need JavaScript enabled to view it..


MC Press books written by Mike Faust available now on the MC Press Bookstore.

Active Server Pages Primer Active Server Pages Primer
Learn how to make the most of ASP while creating a fully functional ASP "shopping cart" application.
List Price $79.00

Now On Sale

JavaScript for the Business Developer JavaScript for the Business Developer
Learn how JavaScript can help you create dynamic business applications with Web browser interfaces.
List Price $44.95

Now On Sale

SQL Built-in Functions and Stored Procedures SQL Built-in Functions and Stored Procedures
Unleash the full power of SQL with these highly useful tools.
List Price $49.95

Now On Sale

BLOG COMMENTS POWERED BY DISQUS

LATEST COMMENTS

Support MC Press Online

$

Book Reviews

Resource Center

  •  

  • 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.

  • 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

  • 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: