zOs/SQL/CATTBCS
-- rows and space per table 00010000
set current path oa1t; 00020004
select substr(fosFmte7(cardf), 1, 7) rows, 00030005
substr(fosFmte7(spacef*1024), 1, 7) bytes, 00040005
smallInt(recLength) recLen, 00050004
smallInt(avgRowLen) avgLen, 00060004
substr(strip(creator) || '.' || strip(name), 1, 20) "cr.tb", 00070004
substr(strip(dbname) || '.' || strip(tsName), 1, 16) "db.ts", 00080004
statstime 00090004
from sysibm.systables 00100001
where type = 'T' and dbName like 'NI%' 00110006
order by creator, name 00120001
; 00130001
select s.dbName, s.name, s.type, min(s.nTables) mi, max(s.nTables) ma, 00140000
count(*) cnt, 00150000
sum(case when t.name is null then 0 else 1 end) tbs 00160000
from sysibm.sysTablespace s 00170000
left join sysibm.systables t 00180000
on t.dbName = s.dbName and t.tsName = s.name 00190000
and t.type in ('T', 'M') 00200000
group by s.dbName, s.name, s.type 00210000
) c 00220000
where (mi <> ma or mi <> tbs) 00230000