zOs/SQL/DDLCHSEL

set current path  = 'OA1P';
insert into oa1p.tQZ120DDLsel
select 'ts', dbName  , name
   from sysibm.sysTableSpace
   where name =    'VDPS026'
--  and ( name like 'A010A%')
;
insert into oa1p.tQZ120DDLsel (ty, qu, nm)
    select 't', creator  , Name
    from sysibm.sysTables
    where -- type = 'T'
            name in ( 'TQZ120DDLSEL'
                    , 'TQZ006GBGRTSSTATS'
                    , 'TQZ050CMD'
                    ) ;
insert into oa1p.tQZ120DDLsel (ty, qu, nm)
    values ('v', 'OA1P', 'VQZ040REBIND') ;
insert into oa1p.tQZ120DDLsel (ty, qu, nm)
    values ('t', 'OA1P', 'TQZ040BINDPGM') ;
select *
    from oa1p.vQZ120DDLChec8
    order by pa, att
;
select *
    from oa1p.vQZ120DDLCheS8
    order by pa, att
;
select *
    from oa1p.vQZ120DDLCheSu8
    order by pa, att
;x;
select ty, substr(qu || '.' || nm, 1, 30), cat, err, pa
    from oa1p.vQZ120DDLCheSum
--  where cat not like 'i%'
--  group by std
    order by pa
; x
/*
 insert into oa1p.tQZ120DDLsel (ty, gp, qu, nm)
 select 't', '', creator , name
    from sysibm.sysTables
    where name like 'TMF150%'
 --  and ( name like 'A010A%')
insert into oa1p.tQZ120DDLsel
     select 'ts', dbName, name, ''
          from sysibm.systablespace
          where dbName like 'MF04A1T' and name = 'A010A'
     union all select 't', creator, name, ''
          from sysibm.systables
          where creator like 'OA1%' and name like 'TMF%' and type = 'T'
     union all select 'ts', dbName, name, ''
          from sysibm.systablespace
          where dbName = 'BE%' -- and name like 'A40%'
     union all select 'v', creator, name, ''
          from sysibm.systables
          where creator = 'GDB9998' and name like 'WK947NU%'
                   and type = 'V'
; */
with t as
(
  select * from oa1p.vQZ120DDLCheck
)
, u (ty, qu, nm, cat, err, pa) as
(
  select * from t
  union all select ty, '', '', '*s', count(*) || ' * ' || ty
       || ': ' || min(qu || '.' || nm) || ' - ' || min(qu || '.' || nm)
     , '*ty ' || ty
    from t
    where cat = 's'
    group by ty
  union all select ty, '', '', '*' || cat, count(*) || ' * ' || err
     , '*tyCatErr ' || ty || cat || err
    from t
    where cat <> 's'
    group by ty, cat, err
)
select ty, substr(qu || '.' || nm, 1, 30), cat, err, pa
    from u
--  where cat not like 'i%'
--  group by std
    order by pa
; x
select * from oa1p.vQZ120DDLCheck -- where cat = 'n'
;x;
select count(*), ty, cat, min(err), max(err)
    from oa1p.vQZ120DDLCheSz
--  where cat not like 'i%'
    group by ty, cat
    order by ty, cat
;
select * from oa1p.vQZ120DDLCheSz order by pa, err