zOs/SQL/CATCOLLE

with c as
(
  select  recLength
      , sum(length) leSum
      , sum(case when nulls = 'Y' and colType not like '%LOB%'
                and colType <> 'XML' then 1 else 0 end) leNul
      , sum(case when colType like '%VAR%' or colType = 'ROWID' then 0
         when colType = 'DECIMAL' then int(floor(real(length)/2)+1)
         when colType like '%LOB%' or colType = 'XML' then 2 + length
                                  else length end) leFix
      , sum(case when colType like '%VAR%' or coltype = 'ROWID'
                          then 2+length         else 0 end) leVa
      , case when edProc = '' then 0 else 10 end edProc
      , t.creator, t.name, t.type
    from sysibm.sysTables t join sysibm.sysColumns c
      on t.creator = c.tbCreator and t.name = c.tbName
    where t.name like '%' and type not in ('V', 'A', 'P', 'X')
    group by t.creator, t.name, t.recLength, t.type, t.edProc
)
select leFix+leVa+leNul+edProc+8, c.*
    from c
    where leFix+leVa+leNul+edProc+8 <> recLength
    with ur
;x;
, s as
(
  select sum(recLength) recLength
       , sum(leSum    ) leSum
       , sum(leNul    ) leNul
       , sum(leFix    ) leFix
       , sum(leVa     ) leVa
       , sum(edProc   ) edProc
      from c
)
select leFix+leVa+leNul+edProc+8, s.*
    from s