zOs/SQL/QZ060

set current application compatibility 'V11R1';
select date(timestamp), count(*)
        , sum(case when victim_corr_id like '%AUTBND%'
             then 1 else 0 end) vict
        , sum(case when holder_corr_id like '%AUTBND%'
             then 1 else 0 end) hold
        , type, left(name, 10)
        , min(name), max(name)
    from oa1p.tqz060timeout
    where rz = 'RZ2' and dbSys = 'DBOF'
        and (  victim_corr_id like '%AUTBND%'
            or holder_corr_id like '%AUTBND%'
            )
        and timestamp > current timestamp - 2 month
    group by date(timestamp), rollup(type, left(name, 10))
    order by 1 desc, 2 desc
;x;
select *
    from oa1p.tqz060timeout
    where rz = 'RZ2' and dbSys = 'DBOF'
        and type = 'DB' and name = 'WI02A1P'
        and (  victim_corr_id like '%AUTBND%'
            or holder_corr_id like '%AUTBND%'
            )
        and timestamp > current timestamp - 2 month
;x;
select count(*), event_type
               , date(MAX(timestamp)) --, min(timestamp)
               , strip(min(name)) || ' - ' || max(name)
               , MAX(timestamp),  min(timestamp)
    from oa1p.tqz060timeout
    where rz = 'RZ2' and dbSys = 'DBOF'
        and timestamp > current timestamp - 2 month
        and ( name like '%XC01A1P%')
        and     timestamp between '2015-09-01-00.00.00'
                              and '2016-04-22-23.00.00'
    group by left(name, 15), event_type
                , trunc_timestamp(timestamp, 'iw')
    order by trunc_timestamp(timestamp, 'iw') desc, 1 desc
;x;
select count(*), rz, ssid, dbSys
      , max(loadDate)
      , max(timestamp)
      , min(loadDate)
      , min(timestamp)
    from oa1p.tqz064LockEscal
    where rz = 'RZ2'
  --    and type like '%ID%'
        and timestamp > '2015-10-01-12.38.19'
    group by rz, ssid, dbSys, loadDate
    order by rz, ssid, dbSys, loadDate desc
;x;
  select date(trunc_timestamp(timestamp, 'mon'))
      , count(distinct date(timestamp)), count(*)
      , max(loadDate)
      , max(timestamp)
      , min(loadDate)
      , min(timestamp)
    from oa1p.tqz065Abend
    where rz = 'RQ2' -- and dbSys = 'DE0G'
        and timestamp >= '2014-01-01-00.00.00'
   --   and loaddate > '01.06.2015'
    group by trunc_timestamp(timestamp, 'mon')
    order by 1 desc
;x;
select *
    from oa1p.tqz064LockEscal
    where rz = 'RZZ' and dbSys = 'DEVG'
        and timestamp = '2015-09-03-14.38.34'
;x;
select *
    from oa1p.tqz065Abend
    where rz = 'RZZ' and dbSys = 'DEVG'
        and timestamp = '2015-09-09-11.07.38'
;x;
select *
    from oa1p.tqz063UOW
    where rz = 'RZZ' and dbSys = 'DEVG'
        and timestamp = '2015-09-09-10.42.20'
;x;
select *
    from oa1p.tqz060timeout
    where rz = 'RZZ' and dbSys = 'DEVG'
  --    and type like '%ID%'
        and timestamp = '2015-09-07-12.38.19'
;x;
  union all select count(*), date(timestamp)
    from oa1p.tqz065Abend
    where rz = 'RZX' and dbSys = 'DE0G'
        and timestamp >= '2015-01-01-00.00.00'
    group by date(timestamp)
select count(*), date(timestamp)
    from oa1p.tqz065Abend
    where rz = 'RZX' and dbSys = 'DE0G'
        and timestamp = '2015-09-29-06.49.48'
;x;
select count(*), date(timestamp)
    from oa1p.tqz065Abend
    where rz = 'RZX' and dbSys = 'DE0G'
        and timestamp = '2015-09-29-06.49.48'
;x;
select count(*), holder_plan, trunc_timestamp(timestamp, 'dd')
    from oa1p.tqz060timeout
    where rz = 'RZ2' and dbSys = 'DBOF'
        and timestamp > current timestamp - 12 month
      --and ( name like '%DW52%' or name like '%DW50A1P%')
        and (holder_plan = 'KE5480' or victim_plan = 'KE5480')
     group by holder_plan, trunc_timestamp(timestamp, 'dd')
     order by 3 desc
;x;
select *
    from oa1p.tqz060timeout
    where rz = 'RZ2' and dbSys = 'DBOF'
        and timestamp > current timestamp - 2 month
      --and ( name like '%DW52%' or name like '%DW50A1P%')
        and (holder_plan = 'KE5480' or victim_plan = 'KE5480')
     order by timestamp desc
;x;
select count(*), event_type
               , date(MAX(timestamp)) --, min(timestamp)
               , strip(min(name)) || ' - ' || max(name)
               , MAX(timestamp),  min(timestamp)
    from oa1p.tqz060timeout
    where rz = 'RZ2' and dbSys = 'DBOF'
        and timestamp > current timestamp - 12 month
        and ( name like '%DW52%' or name like '%DW50A1P%')
        and not timestamp between '2014-02-20-00.00.00'
                              and '2014-02-22-23.00.00'
    group by left(name, 15), event_type
;x;
select count(*), event_type
               , date(MAX(timestamp)) --, min(timestamp)
               , strip(min(name)) || ' - ' || max(name)
               , MAX(timestamp),  min(timestamp)
    from oa1p.tqz060timeout
    where rz = 'RZ2' and dbSys = 'DBOF'
      --and timestamp > current timestamp - 1 month
        and ( name like '%DW52%' or name like '%DW50A1P%')
    group by left(name, 15), event_type