zOs/TX/WK600RUN

$*(
     runstats all tablespaces (without index|)
         with runstats much smaller than realTimeStats
         such that rebuild will not fail for sort allocations
$*)
call sqlConnect DBOF
$;
$>.jclSub()
call sqlPreOpen 1,
  , "select t.cardf, sum(real(r.totalRows)),",
          " strip(t.dbName) || '.' || strip (t.tsName)",
        "from sysibm.sysTables t,",
            "sysibm.sysTablespace s,",
            "sysibm.sysTableSpaceStats r",
       "where",
            "s.dbName = t.dbName and s.name = t.tsName" ,
            "and r.dbName = s.dbName and r.name = s.name" ,
            "and r.dbid = s.dbid and r.psid = s.psid" ,
            "and s.dbName = 'DMAREC'",
       "group by t.dbName, t.tsName, t.cardf",
       "having" ,
            "t.cardf < sum(real(r.totalRows)) * .3",
            "and max(t.cardf, sum(real(r.totalRows))) > 1e7"
$@do ix=1 while sqlFetchInto(1, ":ca, :ro, :ts") $@=[
    $=iy =- right(ix, 3, 0)
    $=ts =- ts
//YMRUN$iy JOB (CP00,KE50),
//       'DB2 RUN',MSGCLASS=T,TIME=1440,
//         NOTIFY=&SYSUID,REGION=0M
//*MAIN CLASS=LOG
//STEP1 EXEC PGM=DSNUTILB,TIME=1440,
//   PARM=(DBOF,'YMRUN$iy.RUNSTA'),
//   REGION=0M
//*DSSPRINT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
//UTPRINT  DD SYSOUT=*
//SYSOUT   DD SYSOUT=*
//RNPRIN01 DD SYSOUT=*
//SYSIN DD *
     LISTDEF LST#STA   INCLUDE TABLESPACE $ts
     OPTIONS EVENT (ITEMERROR, SKIP)

   RUNSTATS TABLESPACE LIST LST#STA
         SHRLEVEL CHANGE
    $]
call sqlDisconnect
$#out                                              20091221 09:33:53
$#out                                              20091221 09:33:30
$#out                                              20091221 09:33:01
$#out                                              20091221 09:32:26