Troubleshooting
Problem
This document provides an easy-to-use alternative to counting jobs in a 5250 application interface.
Resolving The Problem
The qshell ps (process) utility can be used to determine how many jobs are running on a system and even give a count of how many of a particular job are running.
As an example, you would like to know how many CLI server mode jobs (QSQSRVR) jobs are active on the system right now. You try running the WRKACTJOB JOB(QSQSRVR) command, and you are quickly dissuaded from using it after scrolling down through your 20th page of jobs. There must be a better way; and there is. As an alternative solution, you should try going into the qshell environment, piping the output of the ps -e command into the grep utility, and have grep count the number of lines containing the text qsqsrvr.
On the command line, type the command QSHto start or re-enter the qshell environment. From the qshell prompt ($), type the following command:
ps -e | grep -c qsqsrvr
and the result is: 753! There are 753 QSQSRVR jobs running right now.
Let's break this command down a bit to understand just what is happening. The ps -e command is very straightforward. It lists every active process on the system to the standard output device (the screen). If you run this command all by itself, you will get several screens' worth of process information. Notice that all of the text is in lowercase letters; that is significant for the next part.
Now ps -e by itself is great; however, you just want to know how many QSQSRVR jobs are running. So, you want to pipe the ps output into the grep command. The grep utility is a very robust text search and parse utility with a lot of features. Let's say you want it to select only the lines from the ps -e command that have the text qsqsrvr in them. It is important that the text be typed in lowercase letters because grep is normally case-sensitive. By adding the -c option to the grep command, it will display a count of the number of lines that it found qsqsrvr on instead of just displaying the lines themselves.
As an example, you would like to know how many CLI server mode jobs (QSQSRVR) jobs are active on the system right now. You try running the WRKACTJOB JOB(QSQSRVR) command, and you are quickly dissuaded from using it after scrolling down through your 20th page of jobs. There must be a better way; and there is. As an alternative solution, you should try going into the qshell environment, piping the output of the ps -e command into the grep utility, and have grep count the number of lines containing the text qsqsrvr.
On the command line, type the command QSHto start or re-enter the qshell environment. From the qshell prompt ($), type the following command:
ps -e | grep -c qsqsrvr
and the result is: 753! There are 753 QSQSRVR jobs running right now.
Let's break this command down a bit to understand just what is happening. The ps -e command is very straightforward. It lists every active process on the system to the standard output device (the screen). If you run this command all by itself, you will get several screens' worth of process information. Notice that all of the text is in lowercase letters; that is significant for the next part.
Now ps -e by itself is great; however, you just want to know how many QSQSRVR jobs are running. So, you want to pipe the ps output into the grep command. The grep utility is a very robust text search and parse utility with a lot of features. Let's say you want it to select only the lines from the ps -e command that have the text qsqsrvr in them. It is important that the text be typed in lowercase letters because grep is normally case-sensitive. By adding the -c option to the grep command, it will display a count of the number of lines that it found qsqsrvr on instead of just displaying the lines themselves.
[{"Type":"MASTER","Line of Business":{"code":"LOB68","label":"Power HW"},"Business Unit":{"code":"BU070","label":"IBM Infrastructure"},"Product":{"code":"SWG60","label":"IBM i"},"ARM Category":[{"code":"a8m0z0000000CbFAAU","label":"Data Access-\u003EQShell"},{"code":"a8m0z0000000CHQAA2","label":"Qshell"}],"ARM Case Number":"","Platform":[{"code":"PF012","label":"IBM i"}],"Version":"All Versions"}]
Historical Number
524426574
Was this topic helpful?
Document Information
Modified date:
20 November 2024
UID
nas8N1012938