zOs/SQL/GBGRSPCT

     -- table Space und Details für 1 StichDatum
set current path oa1p;
with t2 as --- Partition und neuesten loadTS --------------------------
(
   select rz, dbSys, dbName, name, instance, partition
       , max(loadTs) loadTs
     from oa1p.tqz006GbGrTsSTats
    where rz = 'RZ2' and dbSys = 'DVBP'
  --    and dbName = 'MF01A1P' and name like 'A150%'
        and loadTs <= timestamp(current date + 1 day)
    group by rz, dbSys, dbName, name, instance, partition
)
, t as --- join tsStats, falls nicht dropped --------------------------
(
   select r.*
     from t2
      join oa1p.tqz006GbGrTsSTats r
        on t2.loadTS is not null and r.state <> 'd'
                and t2.rz        = r.rz
                and t2.dbSys     = r.dbSys
                and t2.dbName    = r.dbName
                and t2.name      = r.name
                and t2.instance  = r.instance
                and t2.partition = r.partition
                and t2.loadTs    = r.loadTS
)
select rz, dbSys, dbName, name
      , substr(case when tsTy <> '' then tsTy else tsType end
          || case when clone in ('N', '?') and instance=1 and tsInst=1
                  then ''
                  else case when instance=tsInst then 'b' else 'c' end
                      || instance end, 1, 3) "yci"
      , substr(case when partition = 0 and parts = 0 then ''
            else case when partition is null            then ' ---'
                      when partition = 0 and tsTy = 'G' then ' pbg'
                      when partition = 0                then ' ???'
                      else right('   ' || partition, 4)
                 end
             ||'/'|| value(right('   '|| parts, 4),'----')
            end, 1, 9) "part/ tot"
   -- , smallInt(partition) part
      , substr(fosFmte7(real(nActive) * pgSize * 1024), 1, 7) used
      , substr(fosFmte7(totalRows), 1, 7) rows
      , substr(tb, 1, 30) "table"
 --   , updateStatsTime, t.*
    from t
--  order by rz, dbSys, dbName, name, instance, partition
    order by rz, dbSys, real(nActive) * pgSize * 1024 desc
    fetch first 500 rows only
;