Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
WRKODBCJOB in SQL
-- Bryan Dietz
-- trying to get some results similar to WRKODBCJOB
SELECT Aj.Subsystem
,Aj.Job_Name
,Aj.Authorization_Name AS "Current User"
,Aj.Client_Ip_Address
,Aj.Cpu_Time AS "CPU MS Used"
,Aj.Temporary_Storage as "Temp Storage"
,Aj.Total_Disk_Io_Count as " Disk I/O Count"
,Aj.Sql_Statement_Status
,replace(replace(replace(trim(Aj.Sql_Statement_Text),' ',' ' concat char(2)), char(2) concat ' ',''),char(2), '' ) AS "Last SQL Statement"
FROM TABLE (
Qsys2.Active_Job_Info(
Reset_Statistics => 'NO', Job_Name_Filter => 'QZDA*', Detailed_Info => 'ALL')
) AS Aj
WHERE 1 = 1
and Aj.Authorization_Name LIKE '%%' -- enter a user name to search
AND Aj.Client_Ip_Address in ('','1.2.3.4') -- enter IP addresses to search
ORDER BY Aj.Authorization_Name;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment