Page 1 of 1

Row Count using Stage Variable

Posted: Thu Dec 02, 2010 7:34 am
by sachinag
Hi,

I am using one seq file linked to a transformer and then one output sequential file.I want to calculate number of records that are coming from my input seq file.I don't want to process the column that are coming from input seq file.
Only record count should be remain in the output file.

can we do this using stage variables in transfomer without using any additional stage like aggregator or without any command in unix.


Sachin Gupta

Posted: Thu Dec 02, 2010 8:46 am
by chulett
No. Perhaps in 8.5 when it can recognize EOD or perhaps with looping but older versions will require aggregation. Or just use a script to get the line count and echo it to the output file. :wink:

Re: Row Count using Stage Variable

Posted: Thu Dec 02, 2010 9:28 am
by Shruthi
You can get the link count in after job routine using DSGetLinkInfo function

DSGetLinkInfo(jobname, stagename, inlinkname , DSJ.LINKROWCOUNT)

Posted: Thu Dec 02, 2010 9:41 am
by chulett
Yes, but that would be 'too late' in this case. Well... unless you wrote everything to the file, got the count after job and then overwrote the file with the total. I suppose. :?

Posted: Thu Dec 02, 2010 11:27 am
by kondeti
Yes, I have done the same as Chulett metioned for one of my requirement. It's a workaround solution.

Posted: Thu Dec 02, 2010 1:42 pm
by ray.wurlod
How about using wc -l filename as a filter command?

Posted: Thu Dec 02, 2010 2:16 pm
by chulett
One should be able to make that work as well, even though it violates the "without any command in unix" rule. Technically. :wink:

Posted: Thu Dec 02, 2010 6:10 pm
by ray.wurlod
I guessed that was only because the server platform is Windows, but MKS Toolkit (which installs with Information Server on the engine tier) gives access to such commands.

Posted: Thu Dec 02, 2010 7:39 pm
by chulett
True dat.

Posted: Sun Dec 05, 2010 11:26 pm
by abhijitg
Sachin,

If your not manipulating any of the input columns and the only output you need is the row count, why are you using a transformer in the first place? Go with an aggregator instead of the transformer.

Abhijit