Original Message:
Sent: 8/7/2024 3:20:00 PM
From: jerry ven
Subject: RE: SQL query to find a specific job
Thanks,
As 'Job_Name' already have 'User name' in it along with the job number and Job name so why is it specifically required to mention "
current_user_list_filter => 'USERA,USERB', " in that SQL Query here?
...Also whatif the job is no longer active in the system (went into 'OutQ' or 'ended' ,'completed' or we want to find out very old job which had failed in the system very long back (months or even years back, or even decades or even the first job which failed in that specific production system and we are unable to find out it's details using DSPJOB, WRKJOB command etc. ? ) then using same SQL Query how can we reduce it's execution time also I hope the SQL Query which I shared should be able to find out details of any job( irrespective of it's status active or not active and irrespective of the time when it had failed or completed successfully etc.) in the system (please correct me if my understanding is wrong here)
but when I try to execute the same it seems to be taking too much time( just noticed when my select SQL query for that particular job runs it starts increasing the CPU%(Checked through WRKACTJOB for that SQL Qry when it started running) , could it cause performance issue( or any record lock or may cause any other job to go into 'MSGW' etc. in the production system , if this Select SQL Query keeps running for a longer period of time and we keep on waiting it to complete and to show us the details of the desired job's details here?)
Thanks much..
Original Message:
Sent: Wed August 07, 2024 02:32 PM
From: Daniel Gross
Subject: SQL query to find a specific job
If the job is active, use the QSYS2.ACTIVE_JOB_INFO table function and try to restrict the amount of information that you retrieve in the first place:
select *
from table(
active_job_info(
job_name_filter => 'MYJOB',
current_user_list_filter => 'USERA,USERB',
subsystem_list_filter => 'QINTER,QBATCH',
detailed_info => 'NONE'
)
);
By using the filter parameters you restrict the amount of information that has to be collected. So try to restrict as much as possible before using WHERE conditions.
This way the function(s) perform quite fast.
Original Message:
Sent: 8/7/2024 12:18:00 PM
From: jerry ven
Subject: SQL query to find a specific job
Hi,
Is there any way to reduce execution time of below job to find the desired job detail?
"SELECT *
FROM TABLE(QSYS2.JOB_INFO(
JOB_STATUS_FILTER => '*ALL',
JOB_TYPE_FILTER => '*ALL',
JOB_SUBSYSTEM_FILTER => '*ALL',
JOB_USER_FILTER => '*ALL',
JOB_SUBMITTER_FILTER => '*ALL'
)) "
Apart from running this SQL query "SELECT JOB_NAME like '%Jobnumber/USERName/JobName%' FROM TABLE(QSYS2.JOB_INFO) " ?
Thanks much..