Prior to running the SQL below, I used STRQMQRY to run in batch. You'll need to use the DSPFD (TYPE *MBRLIST) command to populate an output file containing all of the file description information on the files you are interested in.
The query selects and displays file information, when the percentage of deleted records is greater than 25% of the number of active records.
SELECT MLLIB,MLFILE,MLNAME,MLNRCD,MLNDTR, MLNDTR+MLNRCD as "Tot Recs", decimal(round(MLNDTR/(MLNDTR+MLNRCD), 4), 5, 4)*100 AS "Pct Dltd", decimal(round(MLSIZ2*(MLNDTR/(MLNDTR+MLNRCD)/1000), 0),15, 0) AS "K-Bytes Wasted", MLMTXT,MLSIZ2 FROM SYSLIB/PRDFILES WHERE MLNDTR > (.25 * MLNRCD) ORDER BY "K-Bytes Wasted" DESC
Requires Free Membership to View
Register today to access targeted resources from our editorial writers and independent industry experts including news, tips, and advice to help you do your job more efficiently and effectively. Stay informed on the hottest topics and biggest challenges faced by IT professionals working with iSeries products and services.
This was first published in January 2005