Page 1 of 1

Setting column value as Parameter

Posted: Wed Mar 25, 2009 9:36 pm
by verify
I have a sequential file as source it has one field as "Table_Name".My requirement is to extract the table name values from the Table_Name field and create a target file with name as that of "Table_Name".

Note: The sequential file will contain only one record.

For e.g:-
Case1:-
Source:-
Table_Name Col1 Col2
Emp Tom 23

I have to create target file with "Emp" as it's name.

Similarly for Case2:-
Source:-
Table_Name Col1 Col2
dept Finance 30

I have to create target file with "dept" as it's name.

Do i need to set the column value as parameter.
In transformer i tried using DSSetParam command to set as parameter but it didn't work..

Please help me out...

Re: Setting column value as Parameter

Posted: Wed Mar 25, 2009 10:46 pm
by Pagadrai
Hi,
You cannot change the value or assign the job parameter when the job is executing. That is why DSSetParam wont work in the transformer.

You have to fetch the value from the file and then pass it to the DS job as paramter.

Posted: Wed Mar 25, 2009 10:53 pm
by chulett
You could create two jobs - one to fetch the values and pass them as parameters to the second job to do the creation. Use UtilityRunJob() in the first job to run the second job once per record read.

Posted: Wed Mar 25, 2009 11:36 pm
by ray.wurlod
The first job will need to be a server job or use the BASIC Transformer stage if a parallel job.

Posted: Thu Mar 26, 2009 1:28 am
by shamail
Or probably u can try writing the first field that is name of the file into a file in the same job and use the content of this file in a after job subroutine to the rename the original file (one containing the data) created in the same job.