Way back in week 28 in 2001 I wrote a tip about the SQL parameter for DSNTIAUL. This parameter enables the execution of SQL SELECT statements when unloading DB2 tables. But what happens if you write something else than a SELECT statement?
To my big surprise DSNTIAUL executes any kind of dynamic SQL statement. And the number of SQL statements are not limited to just a single one. If you separate your SQL statements with the usual semicolon (;) DSNTIAUL will execute them all in the same way as DSNTIAD and DSNTEP2 does. If a SELECT statement occurs, the result will be unloaded to SYSREC00, the next SELECT statementresult to SYSREC01 and so forth. This is just exceptional.
When I made this discovery I used it to make an UPDATE of a status table telling me how far DSNTIAUL has come. Then I issued a COMMIT and a SELECT to unload the data. After the SELECT I executed another UPDATE of the status table and a new COMMIT. In this way I know for sure that the unload completed successfully. I am pretty confident that you will be able to use the information in this tip for something just as or even more useful. Good luck.