zOs/SQL/TADM09EX

------------------------------------------------------------------------
--
--  extrapolation space Bedarf aus tadm09A1
--       heute     = heutige Grösse in Bytes
--       heute+20% = heute + 20%
--       ext1mon   = Extrapolation aus letztem Monat auf ZielDatum
--       ext3mon   = Extrapolation aus letzten  3 Monaten auf ZielDatum
--       ext1year  = Extrapolation aus letztem Jahr auf ZielDatum
--
--       Extrapolation = lineares Wachstum mit (max - min) / Periode
--       Zieldatum = 01.04.2012
--
------------------------------------------------------------------------
set current path oa1p;
with v as
( select DB_NAME                 db
       , substr(TS_NAME, 1, 8)   TS
       , min(PARTITIONS_TOTAL)   parts
       , smallint(PARTITIONS_NR) PA
       , min(DS_SIZE)            dssize
       , min(large)              LARGE
       , sum(HI_U_RBA)           HI_U_RBA
       , DATUM                   DATUM
  from OA1P.TADM09A1
  group by DB_NAME, TS_NAME, PARTITIONS_NR, datum
), w as
(
select db, ts, pa
       , max(case when datum = current date
                 then hi_u_rba else -999 end)  heute
       , min(case when datum > current date - 1 month
                 then hi_u_rba else -999 end) min1mon
       , max(case when datum > current date - 1 month
                 then hi_u_rba else -999 end) max1mon
       , min(case when datum > current date - 3 month
                 then hi_u_rba else -999 end) min3mon
       , max(case when datum > current date - 3 month
                 then hi_u_rba else -999 end) max3mon
       , min(case when datum > current date - 1 year
                 then hi_u_rba else -999 end) min1year
       , max(case when datum > current date - 1 year
                 then hi_u_rba else -999 end) max1year
    from v
    where datum > current date - 1 year
    group by DB, ts, pa
)
select db, ts, pa
      , fosfmte7(heute) "heute"
      , fosfmte7(1.2 * heute) "heute+20%"
      , fosfmte7(max1mon + (max1Mon-min1mon)
              / (days(current date)-day(current date - 1 month))
              * (days('01.04.2012') - days(current date))) "ext1mon"
      , fosfmte7(max3mon + (max3Mon-min3mon)
              / (days(current date)-day(current date - 3 month))
              * (days('01.04.2012') - days(current date))) "ext3mon"
      , fosfmte7(max1year + (max1year-min1year)
              / (days(current date)-day(current date - 1 year ))
              * (days('01.04.2012') - days(current date))) "ext1year"
    from w
    where db = 'SN01A1P' -- and ts_Name = 'SXBE141'
    order by db, ts, pa
    with ur
;                            ;;;