Obtaining the status of z/OS UNIX application program processes

When the XL C/C++ application program you are developing runs, you can check the processes assigned to it to determine where it is running and how much processor time it is using.

In order for you to be able to check the status of your application program processes, the program must run in a shell or create processes by requesting XL C/C++ services. You can check the status of processes for executable files running in the following environments:
  • Shell foreground
  • Shell background
  • TSO/E foreground, when processes are started
  • MVS™ batch, when processes are started
Note: If the application program is submitted for MVS batch processing using the BPXBATCH program, a JCL job stream is used to invoke a batch program, which executes a shell environment from which the application program executable file is run.
You must also enter a shell ps or jobs command to determine the process IDs for the application if you do not already have them recorded.

To check the status of your XL C/C++ application program processes, do the following:

  1. Record the process IDs when the application is started.
  2. Issue the process status or job status command when you want to check on the shell-initiated application:
    ps
    The preceding command displays the status of only those processes associated with the default user ID. The following command, when entered by a user with superuser authority, displays the status of all active processes. Otherwise, it displays the status of all processes associated with the default user ID.
    ps -A
    The following command displays the status of all active jobs in the shell—including process ID and user ID information:
    jobs -l
    Note: If the application was started from TSO/E for MVS batch submission and you go into the shell (using the TSO/E OMVS command to create a shell environment or the PA1 key from the TSO escape prompt to return to an existing shell environment), you can use the ps command to determine the status of the processes associated with your user ID. If you stay in the TSO/E environment, you can use TSO/E commands to check the MVS batch job queues.
  3. From the resulting status display, check the status of the process and any of its child processes.
  4. Record the necessary process IDs for the application program's job.
If you are running the application program executable file from a shell and it appears to be hung, and you cannot enter shell commands, you can query the process status and IDs either by using the open subcommand or by creating another shell session. When the second shell session is started, enter:
ps -ef
and record the process ID for the application. You can then kill the XL C/C++ application program process. For information on killing processes, see Killing a runaway process. To return to the first shell session, enter: exit.

The output from the ps command is displayed to stdout, which is normally the terminal. You can redirect output from the command using the > character and a specified z/OS UNIX filename.