Admin Alert: The Great i5/OS Job Hunt
December 14, 2005 Joe Hertvik
When running an OS/400 or i5/OS help desk, it’s not always possible to know which jobs need troubleshooting. Users can provide sketchy information when calling in, and you may not be able to view a troubled session or to remotely log on to user systems to check out problems for yourself. Many times, your first job in helping a user is to determine which job actually has the problem.
To that end, here are some tips for quickly finding batch or interactive jobs on your i5, iSeries, or OS/400 systems. These tips were tested by using i5/OS V5R3, but most of this functionality should also be available in earlier i5/OS V5 systems as well as in earlier OS/400 V4 versions and below. By using some of these tips from a green-screen session, you should be able to quickly find and work with troubled jobs as well as to determine what is causing the problem.
1. Using the Work with Active Jobs command (WRKACTJOB) to find the jobs that you are looking for: When debugging a problem, you may sometimes need to find jobs that are associated with a specific device, job name, or user name. Here’s a few easy ways to use WRKACTJOB to locate problem jobs.
Sequence the WRKACTJOB screen by a designated column: If you know the device, job name, or user name of your problem job, you can easily use the Work with Active Jobs command (WRKACTJOB) to sort all system jobs by one of the WRKACTJOB columns and then locate the job you are looking for by scanning the sorted list alphabetically. To sort your output by a WRKACTJOB column, simply run WRKACTJOB and then move your cursor under the report column you want to sort your fields on and press the F16 key. F16 will resequence the WRKACTJOB screen so that it is sorted by your preferred column, which makes it easy to alphabetically locate any active job you are looking for. Before using F16 to sort by columns, be sure to also press the F14 key, which modifies the screen to include any group, system request, and disconnected jobs in the WRKACTJOB list. These jobs are not included when you run WRKACTJOB with its default parameters.
Search the WRKACTJOB screen for a specific string: If you press F7 from the WRKACTJOB display, you can search for a string literal in several WRKACTJOB columns. Entering F7 brings you to WRKACTJOB’s Find a String box, where you can enter a specific literal to search for as well as the WRKACTJOB column that the command should search for the string in. So if I have several hundred jobs on my system and I want to find active jobs that are disconnected from the system (Status of DSC), I can press F7 from the WRKACTJOB, enter ‘DSC’ in the String parameter of the Find a String box and then enter *STS (status) in the Column parameter of that screen. WRKACTJOB will take me to the first disconnected job it finds on its display. If I want to repeat the search in order to find other disconnected jobs, I can press F8 after the first search and it will take me to the next listed job that has a ‘DSC’ status. I can continue pressing F8 to find more jobs with the same string attributes until there are more no more jobs to be found. And the Find a String box is somewhat flexible in that I can use the following literals in the Column parameter to search through different columns on a WRKACTJOB screen:
*SBS = Subsystem/Job column for finding a string in a subsystem name
*JOB = Subsystem/Job column for finding a string a job name
*USER = User column for locating active jobs belonging to specific users
*NUMBER = Job number column for searching for jobs by their job number
*TYPE = Job type column for searching for different types of jobs, including batch (BCH), interactive (INT), prestart jobs (PJ), and auto start jobs (ASJ)
*STS = Job status column for searching for problem jobs that have a specific job status, including lock waiting (LCKW), message waiting (MSGW), and disconnected (DSC) jobs
*FUNCTION = Job function column, for searching for jobs that are running a specific program name or command
*PTY = Job priority column, for finding jobs running at a specific priority
*POOL = Job pool, to search for jobs running in a specific Work Subsystems (WRKSBS) job pool number
The other cool thing about the Find a String function is that you can enter wildcard strings into it when searching for a certain type of job. For example, if all my PC5250 jobs had screen names that started with the word ‘JOE’ (for example, JOEA1, JOEA2, JOEA3, and so forth), I could search for any of these jobs by entering ‘JOE’ and ‘*JOB in the String and Column fields of the Find a String box.
2. Finding all the jobs for a particular user: OS/400 will display all the jobs for a particular user when you run the Work with User Jobs command (WRKUSRJOB). Simply run WRKUSRJOB with the name of the user you want to display the jobs for, and the command will display all active and completed jobs in the system that were submitted under that particular user ID. Enter a ‘5’ (Work with job) in front of the job you want to examine to display all the job information for that job.
3. Finding all jobs with a specific job name: If you want to find all the jobs that were submitted to run under a specific device name or have a specific job name, use the Work with Job command (WRKJOB) and enter the job name you are looking for under the Job Name parameter (JOB). This will show all active and inactive jobs that have been submitted with that particular job name. Enter a ‘1’ (Select) in front of the version of the job you want to display.
4. Discovering which jobs are allocating records or files your problem job is waiting on: A common problem in i5/OS shops is trying to determine which job has an object lock on a record or file that a distressed job is trying to access. This situation occurs when an active job has a status of LCKW (lock wait) on the WRKACTJOB screen. To determine which job is holding a record or file lock on the requested object, enter a ‘5’ (Work with) in front of the LCKW job’s WRKACTJOB entry. i5/OS will display the Work with Job screen for that particular job. Enter option 12 on the command line (Work with locks, if active) under the Work with Job screen, and the system will bring up the Work with Job Locks screen, which shows the status of all object lock requests that particular job has issued. Look for an object lock entry that has a status of ‘REQ’. ‘REQ’ indicates an outstanding lock request that has been requested but not assigned to the job. If you then enter an ‘8’ (Work with Object Locks) in front of that request, the system will display all the system jobs that have locks on that file. The job that is holding up processing for your LCKW job will be marked with a HELD status.