goldfishhh, this might be part of the problem:
Code:
FROM
TOTDB01.CRITL_BAT CRITL_BAT
INNER JOIN
TOTDB01.PROD_ABEND PROD_ABEND
ON CRITL_BAT.PROC_NM_TXT = SUBSTR(PROD_ABEND.JOB_TXT,1,6)
WHERE
PROD_ABEND.JOB_TXT = CRITL_BAT.PROC_NM_TXT
AND CRITL_BAT.SCHDG_SYS_TXT = 'ZEKE';
I don't understand why you have this in the ON predicate
Code:
CRITL_BAT.PROC_NM_TXT = SUBSTR(PROD_ABEND.JOB_TXT,1,6)
and this in the WHERE clause:
Code:
CRITL_BAT.PROC_NM_TXT = PROD_ABEND.JOB_TXT
(I swapped the order to make the comparison easier)
If the PROC_NME_TXT and the JOB_TXT have to match exactly, don't use the SUBSTR in the ON Clause (then the line in the WHERE clause would not be needed (and the function is probably interfering with index usage).
Code:
FROM
TOTDB01.CRITL_BAT CRITL_BAT
INNER JOIN
TOTDB01.PROD_ABEND PROD_ABEND
ON CRITL_BAT.PROC_NM_TXT = PROD_ABEND.JOB_TXT
WHERE
CRITL_BAT.SCHDG_SYS_TXT = 'ZEKE';
or
FROM
TOTDB01.CRITL_BAT CRITL_BAT
INNER JOIN
TOTDB01.PROD_ABEND PROD_ABEND
ON CRITL_BAT.PROC_NM_TXT = PROD_ABEND.JOB_TXT
AND CRITL_BAT.SCHDG_SYS_TXT = 'ZEKE';
Also, since the only column used from CRITL_BAT is this same column, you could replace it in Select clause with the column from PROD_ABEND. Then you could eliminate the join and do an WHERE EXISTS subquery. It is at least another option to try.