zOs/SQL/RTSREORG

select case when unIns   >  10 then 'u' else ' ' end
    || case when farInd  >   5 then 'f' else ' ' end
    || case when nearInd >   5 then 'n' else ' ' end
    || case when extents > 100 then 'e' else ' ' end threshold,
    t.*
  from
    (select dbname, name, partition,
         case when totalRows = 0 then 0
              else int(real(REORGUNCLUSTINS) * 100    / real(totalRows))
              end unIns,
         case when totalRows = 0 then 0
              else int(real(REORGFARINDREF)  * 100    / real(totalRows))
              end farInd,
         case when totalRows = 0 then 0
              else int(real(REORGNEARINDREF)  * 100   / real(totalRows))
              end nearInd,
         extents,
         totalrows, nActive, space, reorgLastTime, updatestatstime
       from sysibm.tablespacestats
       where dbname = 'WQ01A1P'
    ) t
  order by dbname, name, partition
;
select case when paSplit >  10 then 'p' else ' ' end
    || case when extents > 100 then 'e' else ' ' end threshold,
    i.*
  from
    (select dbname, indexspace, partition,
         case when totalEntries = 0 then 0
              else int(real(REORGLEAFFAR) * 100   / real(totalEntries))
              end paSplit,
         extents,
         totalEntries, nActive, space, reorgLastTime, updatestatstime
       from sysibm.indexspacestats
       where dbname = 'WQ01A1P'
    ) i
    order by dbname, indexspace
;
x
select * from oa1p.tadm08a1
    where db_name = 'NZ06A1P' and ts_name in ('A244A', 'A241A')
;
select count(*), dssize
    from sysibm.systablespace
    group by dssize
    order by dssize
;
x
select dbname, name, sum(totalrows),
       count(*), min(partition), max(partition),
       min(updatestatstime), max(updatestatstime)
    from sysibm.tablespacestats
    where dbname = 'DA540769' -- and name = 'A242A'
    group by dbname, name
    order by dbname, name
;
x
select partition, totalentries, updatestatstime
    from sysibm.indexspacestats
    where dbname = 'DA540769' and indexspace = 'INZ242A1'
;