As a DBA you probably execute utilities against your database objects. And within Toad for DB2 for z/OS you could generate and execute utility statements very easily. On objects such as tablespaces, databases, tables, et cetera, you could select one or more objects in a Database Explorer, right-click and select Utilities. And it will actually bring up a list of the utilities that you can generate very easily.
I'm going to select Reorg here. And up will come the Reorg dialog in which I could specify command options. I could specify there's various different categories of command options. And you could specify data set and image copy options. So for example, during your reorg if you wanted to create local and remote copy images, you can select to do so.
We actually populate a set of default template tables. And you can customize and select your own. Create your own dataset templates if you want to, or use the defaults that we ship. And I'm just going to, r rather quickly here. You can see that we could collect statistics during the execution of the reorg. And on the Script tab, you'll see that we generate the appropriate template statements for your datasets, as well as the utility statement to reorg your tablespace.
So you can see that we've got the necessary template statements. And then the reorg statement with references to the template statement or ddnames. You can see those references there.
So that was an example of a reorg, selecting a tablespace. You can select one or more tables as well. And right-click and select utilities such as Runstats. This will bring up the RunStats dialog. And you can see only the table that was selected is there. But if you want to select all the tables you could do that very quickly with a right-click, Select All. If there's any indexes associated with those tables those can be selected individually or all of them, as well.
And again if you have any options you might want to specify, override, or default, you can do that. And very quickly and easily generate the Runstat statement. And again, if you did not want all tables you can just deselect some of those. And we'll generate the appropriate Runstat statements for only the tables that you've selected. And another example would be on indexes. You could click on one or more indexes and select any utility that's available there. There's the Check Index utility. And you can very quickly and easily generate check index statements.
And one thing that's associated with these is, I mentioned before, it's a dataset templates. When you start our z/OS components will actually lay down a repository and populate that with some defaults. And you can Edit, Create, Create Like those as well. And to do so you just select the dataset templates in the SQL Editor and it will bring up a list of all of them.
They're qualified by schema. You can see that this is my schema here, I've created several. If you wanted to clone the existing ones that we ship, you could very easily do a Create Like. And create a new one call it Copy One. And you could modify the mask that we use. We use a lot of variable, substitution variables, such as user ID, subsystem ID, database tablespace, the standard ones that IBM supplies, we actually allow you to specify those as well. Generate a script and actually insert that, so now we'll have a new data set template.
And so it's very easy to Create, Create Like, and Clone dataset templates here. And so you could then specify those dataset templates in your utility diagrams, utility dialogs. So if you're doing a reorg, now you might want to specify New Image Copy and use that new template that we've created. So you could do that very easy. So there you have it. Executing utilities from DB2 z/OS.