How To
Summary
How to create a report that shows the number of active jobs running on a JOBQ and the maximum active allowed by JOBQ.
Objective
Create a report that displays the number of active jobs by JOBQ and the maximum number of jobs allowed to be active on the JOBQ. The report also displays the number of jobs waiting to run on the JOBQ and their status.
Environment
The JOB_QUEUE_INFO view returns one row for each job queue.
The values returned for the columns in the view are similar to the values returned by the Work with Job Queue (WRKJOBQ) CL command and the Retrieve Job Queue Information (QSPRJOBQ) API.
Authorization: The caller must have:
- *EXECUTE authority to the job queue library, and
- *READ authority to the job queue, or
- *SPLCTL special authority, or
- *JOBCTL special authority and the job queue is defined with OPRCTL(*YES).
Steps
To create a report of JOBQ Activity:
Use the Run SQL Scripts tool, run the following SQL Statement:
SELECT maximum_active_jobs,
active_jobs,
number_of_jobs,
dec(dec(active_jobs, 19, 2) / dec(maximum_active_jobs, 19, 2), 19, 2) * 100 AS jobq_percent_consumed,
job_queue_name,
job_queue_library,
job_queue_status,
subsystem_name,
subsystem_library_name,
released_jobs,
held_jobs,
scheduled_jobs,
text_description
FROM qsys2.job_queue_info
WHERE active_jobs IS NOT null
AND maximum_active_jobs > 0
ORDER BY dec(dec(active_jobs, 19, 2) / dec(maximum_active_jobs, 19, 2), 19, 2) DESC;

NOTE: The report lists the number of Active Jobs, the Maximum number of jobs allowed to run and a Percent consumed by JOBQ.
NOTE 2: The report EXCLUDES all JOBQs that have *NOMAX for the Maximum of active jobs.
To create a report of JOBQ Activity that includes Subsystem Maximums:
Use the Run SQL Scripts tool, run the following SQL Statement:
SELECT jq.maximum_active_jobs,
jq.active_jobs,
jq.number_of_jobs,
dec(dec(jq.active_jobs, 19, 2) / dec(jq.maximum_active_jobs, 19, 2), 19, 2) * 100 AS jobq_percent_consumed,
jq.job_queue_name,
jq.job_queue_library,
jq.job_queue_status,
jq.subsystem_name,
jq.subsystem_library_name,
si.maximum_active_jobs AS subsystem_max_active_jobs,
jq.released_jobs,
jq.held_jobs,
jq.scheduled_jobs,
jq.text_description
FROM qsys2.job_queue_info jq
JOIN qsys2.subsystem_info si
ON jq.subsystem_name = si.SUBSYSTEM_DESCRIPTION
WHERE jq.active_jobs IS NOT null
ORDER BY dec(dec(jq.active_jobs, 19, 2) / dec(jq.maximum_active_jobs, 19, 2), 19, 2) DESC,
jq.maximum_active_jobs DESC;

NOTE: In this scenario, the subsystem is limiting the maximum number of jobs allowed to run.
To review the active jobs in a JOBQ, issue the following SQL:
Use the Run SQL Scripts tool, run the following SQL Statement:
SELECT JOB_NAME,
JOB_ACTIVE_TIME,
SUBSYSTEM,
JOB_QUEUE,
JOB_QUEUE_LIBRARY,
JOB_STATUS,
JOB_ACTIVE_TIME,
FUNCTION_TYPE,
FUNCTION
FROM TABLE (
QSYS2.ACTIVE_JOB_INFO(SUBSYSTEM_LIST_FILTER => 'QBATCH', -- replace the Name of the Subsystem
DETAILED_INFO => 'ALL')
)
WHERE JOB_QUEUE IS NOT null

NOTE: The report displays all jobs that were submitted to the subsystem and specifies the name of the JOBQ that was used.
Document Location
Worldwide
[{"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":"a8m0z0000000CHAAA2","label":"Operating System"}],"ARM Case Number":"TS015766649","Platform":[{"code":"PF012","label":"IBM i"}],"Version":"7.2.0;7.3.0;7.4.0;7.5.0;7.6.0"}]
Was this topic helpful?
Document Information
Modified date:
21 April 2025
UID
ibm17145225