Row Count using Stage Variable

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
sachinag
Participant
Posts: 12
Joined: Fri Mar 12, 2010 4:38 am

Row Count using Stage Variable

Post 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
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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:
-craig

"You can never have too many knives" -- Logan Nine Fingers
Shruthi
Participant
Posts: 74
Joined: Sun Oct 05, 2008 10:59 pm
Location: Bangalore

Re: Row Count using Stage Variable

Post by Shruthi »

You can get the link count in after job routine using DSGetLinkInfo function

DSGetLinkInfo(jobname, stagename, inlinkname , DSJ.LINKROWCOUNT)
Shruthi
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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. :?
-craig

"You can never have too many knives" -- Logan Nine Fingers
kondeti
Premium Member
Premium Member
Posts: 67
Joined: Sat Mar 04, 2006 11:38 am

Post by kondeti »

Yes, I have done the same as Chulett metioned for one of my requirement. It's a workaround solution.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

How about using wc -l filename as a filter command?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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:
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

True dat.
-craig

"You can never have too many knives" -- Logan Nine Fingers
abhijitg
Premium Member
Premium Member
Posts: 10
Joined: Sun Aug 22, 2010 9:54 am
Location: Charlotte, NC

Post 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
Post Reply