0

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!

user3489502
  • 3,451
  • 9
  • 38
  • 66

1 Answers1

0

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.

cschneid
  • 10,237
  • 1
  • 28
  • 39
  • Thanks @cschneid! We use Cobol and we have procedures that we use with JCLs. Getting the list of tables using Cobol then executing a single proc multiple times sounds like a great idea. Is there a way I could use the list of tables I create and loop through it to call the same unload procedure multiple times? Are loops possible in JCLs and procedures? Thanks – user3489502 Sep 17 '15 at 12:56
  • @user3489502 JCL has no looping capabilities. When I've done this sort of thing in the past, I wrote the proc, then the program to generate each step to execute the proc with the correct parameters. Be careful to limit the number of steps to no more than 255, more than that cannot be executed in a single job. – cschneid Sep 18 '15 at 02:16
  • Thanks. I read a little and thinking of using REXX for looping. I'll see what I can find – user3489502 Sep 18 '15 at 10:58