Page 1 of 1

problem with LINKROWCOUNT

Posted: Thu Nov 25, 2010 3:30 am
by mac4rfree85
Hi,

I am trying to get the rowcount of the records from a flat file.

Design

Flatfile ---> Transformer ---> Flatfile

In transformer, am creating a new field which will contain the count of the records in the flatfile. The expression i am using is as below

Code: Select all

DSGetLinkInfo(DSJ.ME,"Jobname","Flatfile_Stagename",DSJ.LINKROWCOUNT)
I am getting only "0" as the rowcount. But it should be 11 and the job is running fine without throwing an error.

Thanks for your help in advance.

Regards,
Magesh

Posted: Thu Nov 25, 2010 3:41 am
by ArndW
There are 2 problems with your code.

Code: Select all

DSGetLinkInfo(DSJ.ME,"Flatfile_Stagename","Flatfile_Linkname",DSJ.LINKROWCOUNT)
The other problem is that this gets called for each row, so your first row value will be 1, the second row 2, etc. This would be more efficient by using @INROWNUM in a transform stage.

Why not use a filter command "wc -l" in your sequential file reading stage and you will get one row with one column containing just what you are looking for.