Christine,
Your question raises several serious issues. When you say "the script keeps crashing" do you mean it crashes TSM, or it gives an error (such as ANR9999D)?
If you are crashing the TSM Server, you need to absolutely stop. Consider getting info from client-side queries, perhaps.
If the query is just erroring, is it because TSM is running out of memory for the SELECT, or because it cannot cache the output? Try running "show memtrend" to see how much memory the TSM Server has been using over past 48 hours (cannot change timeframe). You can also run "show deadlock" while the query is running to see if there are conflicts. Show commands are listed in the "Performance Tuning Guide" but really they are usually unnecessary (and there is no "show script").
If the query is causing TSM to run out of memory, the SELECT is probably doing a complex, ugly JOIN across multiple gigantic tables; consider breaking it down into multiple queries, or having your Sys Admin increase the memory of the LPAR or system.
If there is insufficient temp space, consider running the query with output to your own system; for example:
dsmadmc -admin=myuser -password=secret -tcpserveraddr=TSMBKUP "select node_name, archive_mb from auditocc order by archive_mb desc fetch first 20 rows only" >>TSMBKUP_select-archive-from-auditocc_2016-06-08.txt
Hope one or more of these suggestions helps!
Best Regards,
Robert Luehrs