RC/Migrator can be used to generate pure SQL. The SQL may not in fact be executed at all but may be used in order to provide information about the contents of the
DB2 catalog to users who don't have access to it. It could also be manually altered and executed on another location than it's original source by developers
(for example as the starting point of new work.) In this case they don't want any utility statements generated. It could also be used as input to a DDL to SSID
compare on another subsystem which does not have connectivity to the source subsystem.
- Create a RC/Migrator Migration strategy.
- On the "Create Migration Strategy" screen place an "E" next to TABLE in the "PRIMARY OBJECT TYPE SPECIFICATION". "E" stands for EXPLODE. This option will select all of the chosen primary objects and all their dependent objects which include Indexes, Views etc.
- Next we need to specify the specific CREATORS that we are targeting. The CREATOR field at the bottom of the screen only provides for one CREATOR but if we use the WHERE field we can get around this restriction. Place a "Y" in the WHERE field.
- You will be presented with the "SQL Selection Panel" screen. Here we can enter a WHERE clause that will get the tables we want. See the text that says "Where Clause:"
- You will see normally 8 lines of SQL text that we can enter free text into. Then there is an ORDER BY and under that you can see a list of columns on the SYSIBM.SYSTABLES catalog table.
- In the first line of text next to "01" we enter a these words: AND :2 IN ('creator, 'creator'). 'Creator' is going to be two different table creators that you are looking for in this case. Then press enter.
- After pressing enter this line is resolved like this " AND A.CREATOR IN ( 'CREATOR', 'CREATOR')" The :2 is replaced with A.CREATOR which is the second column on the list at the bottom of the page.
- PF3 out of this and the Strategy is saved. You could go back and update the strategy and go in to change the SQL WHERE clause later if required by placing a "Y" in the WHERE clause field again as you did at the start.
- It saves the strategy like this because there are no selections to be made manually. The strategy will assess the where clause when it does the analysis and will pick the tables to process at that time based on that where clause.
- Next we do the analysis. We want it to produce only SQL, no utilities or other syntax that's not SQL. In "Update options" we select these options
NO .AUTHS ==> Y
BND/DAT/STAT/SQL/GRNT/RI ==> S
COMMIT ASAP ==> Y
No .Auths set to "Y" will produce no .AUTH authid statements to clutter up our SQL.
Setting BND/DAT/STAT/SQL/GRNT/RI to "S" will produce no utility statements that would also clutter up our SQL. Using COMMIT ASAP set to "Y" will produce "COMMIT WORK;" statements instead of .SYNC statements. We don't want any .SYNC statements in our SQL because these are CA Batch Processor statements which are not recognised by anything else.
When finished with these settings PF3 back and submit the analysis with these options. The analysis will contain only the tables that have creators that match our IN Clause, all the Indexes, Views and anything else hanging under the tables, no utility statements, no .SYNC's and no .AUTH's. Just pure SQL statements will be generated as we intended.
There will be the usual RC/Migrator header info and Impact Analysis and Change Analysis reports. To further change the result you could also apply Global Changes at analysis time if needed.
The SQL WHERE clause could be augmented to be much more particular than this example depending on your requirements.
The SQL can then be used by developers as they generally don't want to know or need to know what tablespaces their tables have been created in. The DBA normally worries about such placement and storage allocations.
The other benefit of this pure SQL is that it can be executed by other programs that can run SQL like spufi, DSNTEP2 or QMF on another system without having to do any work to clean out any RC/Migrator specific syntax.