zOs/WK/PLANRENA
$#@
$>.fEdit('::v') $@[
$=subsys=DAEG
$=db=DB2PLAN
$=cr=CMNBATCH
$=ts=- strip(left($cr, 7))
$=suf= _NEW
$=old= _OLD
$=tstCond= < '2011-06-11-00.00.00'
call sqlConnect $subsys
$@=[
//Y4PLANRE JOB (CP00,KE50),'DB2 REO',
// MSGCLASS=T,TIME=1440,
// NOTIFY=&SYSUID,REGION=0M
//S01 EXEC PGM=IKJEFT01,DYNAMNBR=200,TIME=99
//*
//* Achtung: vor rename werden die Views gelöscht,
//* zusätzliche von Hand löschen|
//* Nachher view mit planTb wieder erstellen |
//*
//*
//SYSTSIN DD *
DSN SYSTEM($subsys)
RUN PROGRAM(DSNTEP2) PARMS('ALIGN(LHS)') PLAN(DSNTEP2)
//SYSTSPRT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
//SYSTERM DD DUMMY
//SYSIN DD *
--#SET MAXERRORS 0
set current sqlid = 'S100447';
--#SET MAXERRORS 99
drop VIEW $cr.PLAN_VIEW5 ;
DROP VIEW $cr.PLAN_ViewPred ;
DROP VIEW $cr.PLAN_VIEW1 ;
DROP VIEW $cr.PLAN_VIEW0 ;
DROP VIEW $cr.PLAN_VIEW ;
-- changeman vi
drop VIEW $cr.PLAN_VIEW9 ;
drop VIEW $cr.PLAN_VIEW7 ;
drop VIEW $cr.PLAN_VIEW6_CMN ;
drop VIEW $cr.PLAN_VIEW6 ;
DROP VIEW $cr.PLAN_VIEW3 ;
DROP VIEW $cr.PLAN_Filt ; --??? old name s
commit;
--#SET MAXERRORS 0
$]
$;
$<=[
${ts}G
${ts}I
${ts}J
${ts}O
${ts}Q
${ts}X
${ts}Y
$]
$@for ts1 $@/ts/
$=ts1=- strip($ts1)
$$ -- tablespace $ts1
$;
$<=[ select creator, name
from sysibm.sysTables
where dbName='$db' and tsName = '$ts1'
$] call sqlSel
$| $@forWith tb $@/tb/
if $cr <> $CREATOR then
call err 'cr' $cr '<>' $CREATOR'.'$NAME
if right($NAME, length($suf)) \== $suf then
call err 'table' $NAME 'suffix \==' $suf
$=fTb=- left($NAME, length($NAME)-length($suf))
$=laCo=- catTbLastCol($CREATOR, $fTb)
if $laCo \== '' then $@[
$@=[
-- rename tb $CREATOR.$fTb to $old
rename table $CREATOR.$fTb
to $fTb$old ;
$]
$;
$<=[
select creator ixCr, name ix from sysibm.sysIndexes
where tbCreator ='$CREATOR' and tbName ='$fTb'
$] call sqlSel
$| $@forWith ix $@=[
rename index $IXCR.$IX
to $IX$old ;
$]
$]
$@=[
rename table $CREATOR.$NAME
to $fTb ;
$]
$;
$<=[
select creator ixCr, name ix from sysibm.sysIndexes
where tbCreator ='$CREATOR' and tbName ='$NAME'
$] call sqlSel
$| $@forWith ix $@[
if right($IX, length($suf)) \== $suf then
call err 'index' $IXCR.$IX 'suffix \==' $suf
$=rIx=- left($IX, length($IX)-length($suf))
$@=[
rename index $IXCR.$IX
to $rIx ;
$]
$]
$@=[
commit;
$]
$/tb/
$/ts/
if catTbLastCol($cr, COST_TABLE) <> '' then $@=[
rename table $cr.COST_TABLE to COST_TABLE_OLD ;
commit;
$]
$]
$#out 20120208 10:24:57