Page 1 of 1

file count

Posted: Wed Sep 29, 2010 11:55 am
by agpt
Hi,

I have an input file whose number of records keep on varying. I need to capture these number of records and assign it to one column. how can I achieve this?

Posted: Wed Sep 29, 2010 12:24 pm
by anbu
Pass the value of this command as parameter to your job and assign it to the target column

Code: Select all

wc -l < File

Posted: Wed Sep 29, 2010 12:28 pm
by agpt
thnx anbu,

can u pls tell me how do i exactly make parameter out of this command? is it using exec command stage?

Posted: Wed Sep 29, 2010 12:32 pm
by anbu
Either you can use Exec stage

Or

If you are using unix script to call dsjob, then you can execute the command in your unix script and pass it as parameter to the job.

Posted: Wed Sep 29, 2010 12:34 pm
by agpt
And what options i need to set to specify that this particular value would come at run time from parameter?

Posted: Thu Sep 30, 2010 1:03 pm
by sivanagu
did u get solution.

Posted: Thu Sep 30, 2010 1:10 pm
by agpt
sivanagu wrote:did u get solution.

not yet

Posted: Thu Sep 30, 2010 1:40 pm
by sivanagu
create shl script file with below steps

1) define variable and assign count
Val1=`wc -l < /auto/temp_file.txt`

2) define param list and with this veriable
ParamList="-param ABCD=$Val1"

3) call dsjob pass the paramlist
dsjob -run -mode NORMAL $ParamList <PROJECT> <JOB NAME>

4) define parameter in data stage job

5) assign job parameter to column.