Page 1 of 1

Table definitions at runtime

Posted: Mon Jul 16, 2012 10:24 am
by brupun
Can a table definition be passed to a job at runtime? I have a requirement to extract contents from different tables and the client wants me to generalize this process by passing parameters for table name and table definition. I personally think this cannot be done but want some confirmation from the group.

Posted: Mon Jul 16, 2012 4:41 pm
by Kryt0n
Might be possible through RCP

Posted: Tue Jul 17, 2012 12:24 am
by ArndW
The table access stages can work with SELECT * and then use RCP to pass on all columns. But then what do you want to do with those columns? If you are just going to copy everything to a dataset, or pass in a column name as a parameter and check that for a certain value then making generic jobs is quite easy; that is what RCP excels at.
The SQL Select clause can be a parameter which contains your selection criteria, that is easily implemented. But again, what do you want your generic job to actually do?

Posted: Tue Jul 17, 2012 8:25 am
by brupun
I want the generic job to extract data from a table and load into a dataset. Tablename, table definition should be given at runtime. My source is Db2 database table for which I'm using db2 connector. I am going to test RCP method today and see if it fulfills the reuirement. Thanks for your help.

Posted: Tue Jul 17, 2012 8:39 am
by ArndW
Piece of cake with RCP.

1. Declare your source table to use the parameterised SELECT statement (you don't need to pass in the datatypes of the columns that you are selecting)
2. Do not define ANY column in the output link to this stage, just activate RCP in the tick box.
3. Make this link to go a dataset stage and use your parameter to declare the name and path to the dataset descriptor file.
4. Compile & Run

Posted: Tue Jul 17, 2012 12:34 pm
by brupun
Thank you! It worked.