zOs/SQL/LOGEXTCM

with n as
(
  select 'new' on
      , (select count(*)
           from oa1p.tqz060Timeout 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.VICTIM_CORR_ID  = o.VICTIM_CORR_ID
             and t.HOLDER_CORR_ID  = o.HOLDER_CORR_ID
             and t.NAME            = o.NAME
           --    or strip(t.name) || ' 00'
           --       = left(o.name, length(strip(t.name))+3) )
        ) othCnt
      , t.* from A540769.tqz060Timeout t
  where rz = 'RZ2'
    and timestamp between '2014-10-06-04.00.00'
                      and '2014-10-09-05.00.00'
union all
  select 'old' on
      , (select count(*)
           from a540769.tqz060Timeout 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.VICTIM_CORR_ID  = o.VICTIM_CORR_ID
             and t.HOLDER_CORR_ID  = o.HOLDER_CORR_ID
             and t.NAME            = o.NAME
           --    or strip(o.name) || ' 00'
           --       = left(t.name, length(strip(o.name))+3) )
        ) othCnt
      , t.* from oa1p.tqz060Timeout t
  where rz = 'RZ2'
    and timestamp between '2014-10-05-04.00.00'
                      and '2014-10-09-05.00.00'
)
select min(on), max(on)
      , othCnt
      , timestamp
      , rz
      , dbSys
      , ssid
      , EVENT_TYPE
      , VICTIM_CORR_ID
      , HOLDER_CORR_ID
      , NAME
    from n
    where othCnt <> 1
    group by   othCnt
             , timestamp
             , rz
             , dbSys
             , ssid
             , EVENT_TYPE
             , VICTIM_CORR_ID
             , HOLDER_CORR_ID
             , NAME
    having min(on) = max(on)
    order by timestamp, rz, dbSys, event_type, min(on)
;x;
select * from n
    where othCnt <> 1
    order by timestamp, rz, dbSys, event_type, on