arg db user password
/* Connect the target database. Exit if connect fails.
*/
r = REXXSQL("CONNECT" user "IDENTIFIED BY" password "TO"
db)
if sqlcode < 0 then exit 8
/* Prepare and execute a SELECT on SYSCATALOG. */
s = "SELECT CREATOR,TNAME,ROWCOUNT FROM SYSTEM.SYSCATALOG"
,
"WHERE ROWCOUNT >= 10000 ORDER BY
ROWCOUNT DESC"
r = REXXSQL(s)
/* Check for SQL errors. */
if SQLCODE <> 0 then signal SQL_error
/* Show the result stems CREATOR, TNAME and ROWCOUNT */
do i = 1 to _NROWS
tablename = strip(creator.i)"."strip(tname.i)
say "Table" tablename "has" rowcount.i "rows"
end
/* Terminate */
r=REXXSQL("COMMIT")
exit
/* Show SQLCODE, SQLERRM and related help text
*/
SQL_error:
call REXXSQLH sqlcode sqlerrm
exit 8