Created
September 18, 2020 14:29
-
-
Save forstie/f3c4c9ba78f347c0afd9cfa1b20ca90b to your computer and use it in GitHub Desktop.
We were asked... how do you count the number of active user jobs "right now" and see the answer ordered by highest to lowest count. The answer is found below and I've included a version of the SQL that will work for anyone still using IBM i 7.1.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- | |
-- description: Count the number of active user jobs in the system | |
-- minvrm: v7r2m0 | |
-- | |
select authorization_name as user_name, count(*) as active_job_count | |
from table ( | |
qsys2.active_job_info()) j | |
where job_type <> 'SYS' and job_status not in ('PSRW') and | |
j.authorization_name not in (select user_name | |
from qsys2.user_info | |
where user_creator = '*IBM') | |
group by authorization_name | |
order by 2 desc; | |
-- | |
-- description: Count the number of active user jobs in the system | |
-- minvrm: v7r1m0 | |
-- | |
select authorization_name as user_name, count(*) as active_job_count | |
from table ( | |
qsys2.active_job_info('NO', '', '', '') | |
) j | |
where job_type <> 'SYS' and job_status not in ('PSRW') and | |
j.authorization_name not in (select user_name | |
from qsys2.user_info | |
where user_creator = '*IBM') | |
group by authorization_name | |
order by 2 desc; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment