zOs/SQL/PDBPKGNZ

set current path oa1p;
SELECT date(trunc_timestamp(timestamp, 'day'))
         , substr(pck_id,1,8), count(*),
         fosFmtE7(sum(class7_cpu_total)) cpu                        ,
   fosFmtE7(sum(class7_cpu_total) / sum(SQL_STMTS_ISSUED)) "cpu/stm"
  FROM RZ2dd.TACCT_PROGRAM P -- RZ2
  where pck_ID    = 'YCTS100'
      and timestamp between '2012-01-01-00.56.30'
                        and '2012-09-15-23.12.25.53'
  group by pck_id, trunc_timestamp(timestamp, 'day')
  order by 1, 2
--order by class7_elapsed desc
  ;  ;;
SELECT plan_name, count(*)
  FROM RZ2xx.TACCT_PROGRAM P -- RZ2
  where pck_id = 'NZDBM86'
      and timestamp between '2012-06-03-22.56.30'
                        and '2012-06-03-23.12.25.53'
  group by plan_name
--order by class7_elapsed desc
  ;  ;;
SELECT min(timestamp), count(*) cnt,
   fosFmtE7(sum(SQL_STMTS_ISSUED)) stmts,
   fosFmtE7(sum(class7_elapsed) / sum(SQL_STMTS_ISSUED)) "ela/stm",
   fosFmtE7(sum(class7_cpu_total) / sum(SQL_STMTS_ISSUED)) "cpu/stm",
   fosFmtE7(sum(class7_cpu_total)                        ) "cpu    ",
   fosFmtE7(sum(CLASS8_SYNC_IO) / sum(SQL_STMTS_ISSUED)) "sIO/stm"
  FROM RZ2HH.TACCT_PROGRAM P -- RZ2
  where pck_id = 'NZDBM83'
      and timestamp > current timestamp - 45 days
  group by trunc_timestamp(timestamp, 'ddd')
  order by trunc_timestamp(timestamp, 'ddd') desc
  ;  ;;
SELECT min(timestamp), count(*) cnt,
   fosFmtE7(sum(SQL_STMTS_ISSUED)) stmts,
   fosFmtE7(sum(class7_elapsed) / sum(SQL_STMTS_ISSUED)) "ela/stm",
   fosFmtE7(sum(class7_cpu_total) / sum(SQL_STMTS_ISSUED)) "cpu/stm",
   fosFmtE7(sum(CLASS8_SYNC_IO) / sum(SQL_STMTS_ISSUED)) "sIO/stm"
  FROM RZ2DD.TACCT_PROGRAM P -- RZ2
  where pck_id = 'NZ6500'
      and timestamp > current timestamp - 125 days
  group by trunc_timestamp(timestamp, 'DAY')
  order by trunc_timestamp(timestamp, 'DAY') desc
;;;
SELECT *
  FROM RR2DD.TACCT_PROGRAM P -- RZ2
  where pck_id = 'NZ5820'
      and timestamp > current timestamp - 5 days
  order by timestamp desc
;