Last active
January 15, 2025 01:05
-
-
Save bdietz400/350f638ef9f828ec0a2de0166e84a0c5 to your computer and use it in GitHub Desktop.
WRKODBCJOB in SQL
This file contains hidden or 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
-- 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