If you have an application that frequently adds or removes table spaces, you can use the Wildcard field in conjunction with advanced SQL to allow Db2 Automation Expert to resolve the object list at job build time. You can use this feature to avoid manually modifying the object profile whenever your application adds an object.
About this task
Advanced SQL works with the selection criteria that you specify in the Database Like, Tablespace Like, and Creator Like fields on the Enter Tablespaces Like to Display window. The results of selection criteria are intersected with the results of the advanced SQL statement to select the table spaces. When you set Wildcard to Y, the advanced SQL and the selection criteria are evaluated at build time to select the table spaces.
In addition, when the Wildcard field is set to Y, the advanced SQL is saved with the object profile and used at build time to generate the object list.
Procedure
On the Enter Tablespace Like to Display window, enter a database, table space, or creator name or mask in the appropriate fields and enter Y in the Wildcard field.
Note: The Creator Like field allows up to 128 bytes. To scroll this field, place the cursor in the field and use the PF11 key to scroll right and the PF10 key to scroll left.
Enter Y in the Advanced SQL field and Y in the Update SQL field, as showing in the following figure:
Press Enter.
The Object Selection Advanced SQL panel is displayed, as shown in following figure:
Enter your SQL statement in the SQL input area.
You can enter any SQL statement that meets these requirements:
It must be a SELECT statement that specifies the following columns:
The first column is required and must represent a database name.
The second column is required and must represent a table space name.
The third column is optional, but if present must represent a partition number.
The FROM clause must be specified after the SELECT statement.
Use any WHERE clause criteria that identifies the objects to be included in the object profile.
You can enter comments by inserting two consecutive hyphens, followed by the comment. Any characters that follow two consecutive hyphens and are before the end of a line are ignored.
You can optionally enter the T line command to look up table names and their columns on the subsystem. This command invokes the Table Selection panel, which you can use to generate a list of tables on this subsystem and find column names associated with the tables.
The following panel shows a sample valid advanced SQL statement:
To verify that the results of the SQL select statement are as expected, enter EXECUTE in the Option field and press Enter.
The SQL statement is run and the results of the SELECT are listed on the Advanced SQL Test Facility panel, as shown in the following figure:
This panel shows the results of the SQL SELECT statement execution. The data on the panel is read only.
Note: The EXECUTE command runs the SQL statement without consideration for the Database Like, Tablespace Like, and Creator Like criteria that you specified on the Enter Tablespaces Like to Display window.
When you are satisfied with the results of the SELECT statement, on the Advanced SQL Test Facility panel, press PF3 twice.
The window that is shown in the following figure is displayed.
Specify how table space partitions are processed. To handle all partitions (for example, equivalent to a REORG TABLESPACE), enter A in the Explode field. To individually process each partition (for example, equivalent to REORG TABLESPACE PART n), enter P in the Explode field.
Press Enter.
The specified spaces are added to the Update Object Profile Display with Y entered in the corresponding Wildcard column.
What to do next
You can enter the EXPLODE primary command or the E line command to see the expanded list of all table spaces and index spaces currently included in the profile.