24.12.2012 Views

DB2 catalog statistics update REXX EXEC – part 2 This ... - CBT Tape

DB2 catalog statistics update REXX EXEC – part 2 This ... - CBT Tape

DB2 catalog statistics update REXX EXEC – part 2 This ... - CBT Tape

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

6<br />

' FREEPAGE Ø PCTFREE Ø GBPCACHE CHANGED'||<br />

' BUFFERPOOL BP2 LOCKSIZE ANY CLOSE YES';<br />

IF SEGSIZE¬=Ø THEN CRETSPSQL=CRETSPSQL||' SEGSIZE '||SEGSIZE;<br />

END;<br />

ELSE DO;<br />

CRETSPSQL=' IN '||DBNAME||<br />

' NUMPARTS '||PARTCNT||' (';<br />

<strong>EXEC</strong> SQL DECLARE CRS4 CURSOR FOR<br />

SELECT PQTY*4,SQTY*4,VCATNAME,STORNAME,PARTITION<br />

FROM SYSIBM.SYSTABLEPART<br />

WHERE TSNAME=:TSNAME AND DBNAME=:DBNAME<br />

ORDER BY PARTITION;<br />

IF SQLCODE < Ø THEN GOTO HATA;<br />

<strong>EXEC</strong> SQL OPEN CRS4;<br />

<strong>EXEC</strong> SQL FETCH CRS4<br />

INTO :TSPQTY,:TSSQTY,:VCATNAME,:STORNAME,:PARTNUM;<br />

IF SQLCODE < Ø THEN GOTO HATA;<br />

DO WHILE(SQLCODE=Ø);<br />

CRETSPSQL= CRETSPSQL||' PART '||PARTNUM||<br />

' USING STOGROUP '||STORNAME||<br />

' PRIQTY ' || TSPQTY ||<br />

' SECQTY ' || TSSQTY ||<br />

' FREEPAGE Ø PCTFREE Ø GBPCACHE CHANGED ';<br />

IF PARTNUM=PARTCNT THEN CRETSPSQL= CRETSPSQL||')';<br />

ELSE CRETSPSQL= CRETSPSQL||',';<br />

<strong>EXEC</strong> SQL FETCH CRS4<br />

INTO :TSPQTY,:TSSQTY,:VCATNAME,:STORNAME,:PARTNUM;<br />

IF SQLCODE < Ø THEN GOTO HATA;<br />

END;<br />

<strong>EXEC</strong> SQL CLOSE CRS4;<br />

CRETSPSQL= CRETSPSQL||' BUFFERPOOL BP2 LOCKSIZE ANY CLOSE YES';<br />

END;<br />

LB2:DO III=1 TO 2Ø;<br />

UNLINDCH=UNLIND;<br />

NEWTSNAME='UNLOAD'||STRIP_SPACES(UNLINDCH);<br />

CRETSPSQL1='CREATE TABLESPACE '||NEWTSNAME||CRETSPSQL;<br />

<strong>EXEC</strong> SQL <strong>EXEC</strong>UTE IMMEDIATE :CRETSPSQL1;<br />

IF SQLCODE=-6Ø1 THEN UNLIND=UNLIND+1;<br />

ELSE IF SQLCODE=Ø THEN LEAVE LB2;<br />

ELSE IF SQLCODE

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!