zOs/SQL/LOGEXUCM
with n as
(
select 'new' on
, (select count(*)
from oa1p.tqz063Uow o
where t.timestamp = o.timestamp
and t.rz = o.rz
and t.dbSys = o.dbSys
and t.ssid = o.ssid
and t.EVENT_TYPE = o.EVENT_TYPE
and t.PLAN_NAME = o.PLAN_NAME
and t.CORRID_ID = o.CORRID_ID
and t.CONN_ID = o.CONN_ID
and t.AUTHID = o.AUTHID
and t.LOGREC = o.LOGREC
) othCnt
, t.* from A540769.tqz063Uow t
where rz = 'RZ2'
and timestamp between '2014-10-05-04.00.00'
and '2014-10-09-00.00.00'
union all
select 'old' on
, (select count(*)
from a540769.tqz063Uow o
where t.timestamp = o.timestamp
and t.rz = o.rz
and t.dbSys = o.dbSys
and t.ssid = o.ssid
and t.EVENT_TYPE = o.EVENT_TYPE
and t.PLAN_NAME = o.PLAN_NAME
and t.CORRID_ID = o.CORRID_ID
and t.CONN_ID = o.CONN_ID
and t.AUTHID = o.AUTHID
and t.LOGREC = o.LOGREC
) othCnt
, t.* from oa1p.tqz063Uow t
where rz = 'RZ2'
and timestamp between '2014-10-05-04.00.00'
and '2014-10-09-00.00.00'
)
select * from n
-- where othCnt <> 1
order by timestamp, rz, dbSys, event_type, on