In the preceding installment of APIs by Example, I discussed the concept of user-defined servers and the considerations and techniques involved in creating server jobs. One of the requirements that user-defined server jobs need to address is registration of the server job, using the Change Job (QWTCHGJB) API, so that the operating system can recognize it as a server job. Following this registration, you can use, for example, System i Navigator to look up and work with server jobs, both user-defined and system-supplied server jobs.
There’s also a Work Management API that can locate and return information about user-defined and system server jobs. The Open List of Jobs (QGYOLJOB) API has parameters that let you specify job-selection criteria, including the job server type attribute. Using this selection criterion, you can limit the returned list of jobs to server jobs. You can specify any number of server types to return, or you can specify the special value *ALL if you want a list of all server jobs on your system. This article demonstrates using QGYOLJOB to provide to provide a Work with Server Jobs (WRKSVRJOB) command.
There’s a minor challenge involved in specifying the QGYOLJOB server type job selection parameter–there’s no API available to return a list of registered servers and their server type. Thorough investigation reveals that practically the only resource available on a i that provides server information is the QATOCSTART file that contains the TCP/IP servers, Network File System (NFS) servers, and host servers. This file also provides the information required to start and end these servers. Although QATOCSTART contains the server special value (*SMTP, *HTTP, etc.) it does not contain the server type.
While there is no immediate resolution to the problem at hand, server type information is actually documented in the Server table available in the Information Center–a page called “i5/OS TCP/IP troubleshooting: Server table” (at the end of this article, I provide links to the 5.4 and 6.1 server tables) provides a wealth of information about servers, server jobs, job descriptions, subsystems, and server type. So I’ve taken the liberty of creating my own server table that provides the mapping between server and server type for the WRKSVRJOB command, based on a combination of the information found in the aforementioned server table and that found in the QATOCSTART file.
This approach requires you to update the server table whenever user-defined servers are added–and if new system servers are introduced as part of a system upgrade. But it is as good as it gets under the given circumstances. Hopefully IBM will address this shortcoming at some point in the future and provide an API to list the server registry. Due to some inconsistencies in the mentioned documentation I’ve excluded a few servers from my homegrown server table, but as you will see it’s quite easy to enhance the server list, should you choose to include some of the missing servers at a later point. My selective approach will however not prevent servers excluded from my server table to surface in the WRKSVRJOB’s server list panel if you specify SERVER(*ALL) on the WRKSVRJOB command, so use this option to get a complete picture of the server job activities on your system.