Search code examples
databasedb2zosjcl

Tool to automatically unload/load all tables of DB2 databases


Often, we need to unload (DB2 utility) all the data from a database and load it to another database (same structure).

I usually have one unload jcl per table (source db), and one load jcl per table (target db). For 50-100 table databases, it's a lot of jcls and repeated code.

Would it be possible to build a tool that would do all that for me using the DB2 utilities? Example: specifying source and target databases, then SUB...

Any ideas would be appreciated. Thanks!


Solution

  • Yes you can build such a tool. One approach is to write a program in the language of your choosing that will generate the JCL. Another approach is to make a cataloged or in-stream procedure to execute your unload and load utilities, then execute the procedure supplying your tables as parameters.

    If you want to get even fancier, you write a program that reads the DB2 catalog to get your list of tables and write the unload and load JCL for you.