zOs/SQL/REOTIMUP
--- update calculated reoTime
--- first
--- if no job is running use checkref to update eoj's
--- use checkref to update reoTst from RTS
---
--- afterwards usc checkRtc to verify what you have done
---
update s100447.tReoRunPart p
set reoTime = (select rngTime
from s100447.vReoRunRng2 r
where r.tst = p.tst and r.rng = p.rng
)
where part = paVon and reoTime is null
and tst > current timestamp - 10 hours
and exists (select rngTime
from s100447.vReoRunRng2 r
where r.tst = p.tst and r.rng = p.rng
)
;
rollback
;;;
------------------------------------------------------------------
-- checkPart2: check reoTime and ranges
--
select case
when p.paVon <> r.paVon then '97 paVon <>'
when p.paBis <> r.paBis then '96 paBis <>'
when p.part < r.paVon or p.part > r.paBis
then '95 part outside von bis'
when p.reoTime is not null and r.cnt <> r.cntReoTst
then '85 reoTime with reoTst null'
when p.reoTime is not null and p.part <> p.paVon
then '84 reoTime part <> paVon'
when p.reoTime <> r.rngTime
then '83 reoTime <> rngTime'
when p.reoTime is null and r.cnt = r.cntReoTst
and p.part = p.paVon
then '05 reoTime can be set'
else '' end err, p.*, r.*
from s100447.tReoRunPart p, s100447.vReoRunRng r
where p.tst = r.tst and p.rng = r.rng
order by 1 desc, p.tst desc
fetch first 100 rows only