zOs/SQL/CATTBRST
set current sqlid = 'S100447';
-- generate sql for list of tables
-- select count and max(column generated ...) from table
-- alter table alter column restart 1;
with c as
( select *
from sysibm.sysColumns c
where tbName like 'TSV31%' and tbCreator = 'OA1A'
and default between 'D' and 'J'
)
select 'select count (*), max(' || strip(name) || ') from '
|| strip(tbCreator) || '.' || strip(tbName) || ';' , c.*
from c
union all
select 'alter table ' || strip(tbCreator) || '.' || strip(tbName)
|| ' alter ' || strip(name) || ' restart with 1;', c.*
from c
order by 1
;
select count (*), max(BUSINESSUNITID) from OA1A.TSV310A1;
select count (*), max(FEEID) from OA1A.TSV319A1;
select count (*), max(MMINCOMEID) from OA1A.TSV316A1;
select count (*), max(MMPOSID) from OA1A.TSV315A1;
select count (*), max(SACID) from OA1A.TSV317A1;
select count (*), max(SACINCOMEID) from OA1A.TSV318A1;
select count (*), max(SECPOSID) from OA1A.TSV313A1;
select count (*), max(SECTXID) from OA1A.TSV314A1;
select count (*), max(SECURITYID) from OA1A.TSV312A1;
select count (*), max(TAXCLIENTID) from OA1A.TSV311A1;
;;;
alter table OA1A.TSV310A1 alter BUSINESSUNITID restart with 1;
alter table OA1A.TSV311A1 alter TAXCLIENTID restart with 1;
alter table OA1A.TSV312A1 alter SECURITYID restart with 1;
alter table OA1A.TSV313A1 alter SECPOSID restart with 1;
alter table OA1A.TSV314A1 alter SECTXID restart with 1;
alter table OA1A.TSV315A1 alter MMPOSID restart with 1;
alter table OA1A.TSV316A1 alter MMINCOMEID restart with 1;
alter table OA1A.TSV317A1 alter SACID restart with 1;
alter table OA1A.TSV318A1 alter SACINCOMEID restart with 1;
alter table OA1A.TSV319A1 alter FEEID restart with 1;
;;;