21
Thu, Nov
1 New Articles

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

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