zOs/SQL/GBGRELAR

select substr(db, 1, 8) "db"
      , substr(ts, 1, 8) "ts"
      , substr(tsTy
          || case when tsClone = 'N' and inst=1 and tsInst=1 then ''
                  else case when inst=tsInst then 'b' else 'c' end
                      || inst end, 1, 3) "yci"
      , substr(ix, max(1, length(ix) - 7), 8) "...index"
      , substr(case when part = 0 and tsParts = 0 then ''
            else case when part is null                 then ' ---'
                      when part = 0 and ix <> ' --ts--' then ' npi'
                      when part = 0 and tsTy = 'G'      then ' pbg'
                      when part = 0                     then ' ???'
                      else right('   ' || part, 4)
                 end
             ||'/'|| value(right('   '|| tsParts, 4),'----')
            end, 1, 9) "part/ tot"
      , substr(right(case when actGB < 1000
                         then '    ' || dec(round(actGb, 2), 6, 2)
                         else '    ' || int(round(actGb, 0))
                     end, 7), 1, 7) "usedGB"
      , substr(right(case when limGb/100*schwelle < 1000
              then '    ' || dec(round(limGb/100*schwelle, 2), 6, 2)
              else '    ' || int(round(limGb/100*schwelle, 0))
                     end, 7), 1, 7) "schwGB"
      , substr(right('     ' || schwelle, 5), 1, 5) "schw%"
      , substr(right('      ' || int(round(limGb)), 6), 1, 6) "limGB"
      , date(updStats) "lastUpdate"
      , substr(schwinfo, 23, 18) "schwellwert key"
      , g.*
    from OA1P.vQZ006GbGrenz2 g
    where ( actGb > real(limGb / 100 * schwelle)
            or ( db like 'XB%' and actGb > 8.8) )
    and ( db not like 'XB%'
        or (updStats >= '2014-11-17-00.00.00'
        and (nActive, nPages, REORGINSERTS, space, totalRows, dataSize)
        not in ( select z.nActive, z.nPages, z.REORGINSERTS
                  , z.space, z.totalRows, z.dataSize
               from oa1p.tqz006GBGRTSSTATS z
               where    g.rz         = z.rz
                    and g.dbSys      = z.dbSys
                    and g.DB         = z.DBNAME
                    and g.ts         = z.NAME
                    and g.PART       = z.PARTITION
                    and g.INST       = z.INSTANCE
                    and z.loadTs     < '2014-11-17-00.00.00'
               order by z.loadTs desc
               fetch first 1 row only
     )  )  )
        and db <> 'DSNDB01'  -- directory ist anders
        and rz = 'RZ2' and dbSys = 'DVBP'
    order by db, ts, inst, ix, actGb desc, part
 -- fetch first 100 rows only
    ;x;
    order by actGb desc
;
--
-- db         = Datenbank
-- ts         = Tablespace
-- yci        = ts type oder s=Segmented,i=Simple p=PartitionedClassic,
--              clone und Instance (falls geKlont)
-- part/ tot  = betroffene PartitionsNummer / Total Partitonen des ts
-- ...index   = index oder --ts--
-- usedGB     = aktuelle benutzter Platz in GB
-- schwGB     = Schwellwert in GB
-- schw%      = Schwellwert in Prozent der Limite
-- limGB      = physische Limite in GB
-- lastUpdate = letzter update aus RealTimeStats
-- Schwellwert key = key des Schwellwerts in oa1p.tqz008GbGrSchwelle