I use
SELECT ah_alias as Job
,convert ( date, ah_timestamp1) Act_Date
,convert ( time, ah_timestamp1) Act_Time
,convert ( date, ah_timestamp2) Start_Date
,convert ( time, ah_timestamp2) Start_Time
,convert ( date, ah_timestamp4) End_Date
,convert ( time, ah_timestamp4) End_Time
,DATEDIFF(second, ah_timestamp2, ah_timestamp4) as Sec_Dur
,ah_title as Title
,ah_idnr as Runid
,ah_otype as Type
,ah_status as Status
,ah_RetCode as RC
,m.msgtx_text as Status_text
,ah_hostdst as Host
FROM ah a, msgtx m
WHERE ah_client = ?
and (ah_hostdst in (?) or ? IS NULL)
and (ah_status in (?) or ? IS NULL)
and (ah_otype IN (?) or ? IS NULL)
and m.msgtx_msgl_short = ?
and CASE
WHEN 'ACTIVATION' = ? THEN ah_timestamp1
WHEN 'START' = ? THEN ah_timestamp2
ELSE ah_timestamp4
END between ? and ?
and m.msgtx_msg_idnr = a.ah_status
and (ah_otype = 'JOBS')
and (convert( time, ah_timestamp3) between '00:00:00.0000000' and '07:00:00.0000000')
and ah_alias <> 'JOBP.DSMIGN.WORKFLOW'
and ah_alias <> 'JOBS.UNIX.DSMIGN'
and ah_alias <> 'JOBS.GENERIC.CHECK.FILE'
and ah_alias <> 'SCRI.GET_STEPS'
and ah_alias not like 'CALL.ALERT%'
order by ah_alias, ah_otype, ah_status, ah_timestamp2
;
Original Message:
Sent: 01-08-2018 12:07 PM
From: Sudharson Narayanamoorthy
Subject: To get the Job stats based on OH, AH and JPP Tables
Hi
ClausJambrich602320,
Thanks much for the feedback. Query you provided was much helpful.
I will use it as a template for future development.