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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>DB2</strong> <strong>catalog</strong> <strong>statistics</strong> <strong>update</strong> <strong>REXX</strong> <strong>EXEC</strong> <strong>–</strong> <strong>part</strong> 2<br />

<strong>This</strong> month we conclude the article providing a <strong>REXX</strong> <strong>EXEC</strong> that can<br />

be used to <strong>update</strong> <strong>DB2</strong> <strong>catalog</strong> <strong>statistics</strong>.<br />

/*————————————————————————————————————————————————————————*/<br />

/* If we are connected to <strong>DB2</strong> ( <strong>DB2</strong>CON = 1) then <strong>update</strong>s */<br />

/* have been performed, therefore a 'COMMIT' is required. */<br />

/*————————————————————————————————————————————————————————*/<br />

if <strong>DB2</strong>CON = 1 then do<br />

address db2 "COMMIT"<br />

if SQLCODE Ø then do<br />

MESS = 'Error on <strong>DB2</strong> Commit sqlcode ' SQLCODE<br />

return<br />

end<br />

MESS = 'Table/Index <strong>statistics</strong> <strong>update</strong>d'<br />

end<br />

else<br />

MESS = 'No <strong>update</strong>s required for Table/Index <strong>statistics</strong>'<br />

/*———————————————————————————————————————————————————————— */<br />

/* Set DUPD flag to show that new number of rows is active */<br />

/*———————————————————————————————————————————————————————— */<br />

DUPD = 1<br />

return<br />

/*————————————————————————*/<br />

/* Process Index Columns */<br />

/*————————————————————————*/<br />

E_Columns:<br />

if <strong>DB2</strong>CON = Ø then do<br />

address db2 "SIGNON" <strong>DB2</strong>S<br />

if RC > Ø then do<br />

MESS = "Error - Unable to connect to " <strong>DB2</strong>S<br />

RETURN16<br />

end<br />

end<br />

<strong>DB2</strong>CON = 1<br />

/*———————————————————————————————————————————— */<br />

/* Define ISPF Table T£CLM to hold column data */<br />

/*———————————————————————————————————————————— */<br />

address ispexec "TBCREATE T£CLM",<br />

"NAMES(CNAME CFLD NCDATAD NCDATAE CCDATAE CCDATAD CTYPE",<br />

" CLEN)",<br />

"NOWRITE REPLACE"<br />

CNAME = ""<br />

CCFLD = ""<br />

CTYPE = ""<br />

© 1999. Reproduction prohibited. Please inform Xephon of any infringement.<br />

15

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

Saved successfully!

Ooh no, something went wrong!