Record Count in Transformer
Moderators: chulett, rschirm, roy
Record Count in Transformer
Hi ,
I have the job like ....
seq. file.....>transformer......>dataset
I want to count the number of records coming from the source .How can I do that in the transformer stage .
P.S :I don't want to use DSgetlinkinfo() and Aggregator stage or any script
I have the job like ....
seq. file.....>transformer......>dataset
I want to count the number of records coming from the source .How can I do that in the transformer stage .
P.S :I don't want to use DSgetlinkinfo() and Aggregator stage or any script
Best Regards
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
System variable @INROWNUM contains this count. Note that it is per-node.
You can not get the final count until the final row has been processed (on the current node).
You can not get the final count until the final row has been processed (on the current node).
Last edited by ray.wurlod on Sun Jan 15, 2012 12:57 pm, edited 1 time in total.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
-
- Premium Member
- Posts: 1044
- Joined: Wed Sep 29, 2004 3:30 am
- Location: Nottingham, UK
- Contact:
Re: Record Count in Transformer
Then you are pretty much out of luck. Aggregator is the way to do this. Does each row need to know the row count, for instance for computing averages, or a sequence string like "1 of 1000", "2 of 1000" etc., or do you just want one row output with the count? Why do you not want to use an Aggregator?sg33 wrote:P.S :I don't want to use DSgetlinkinfo() and Aggregator stage or any script
There's no way for the Transformer to know that the current row is the last one. You could write a routine to write the @INROWNUM to a file in overwrite mode and then pick up the value afterwards, then read the file. The Transformer would have to run in Sequential mode, not Parallel.
Phil Hibbs | Capgemini
Technical Consultant
Technical Consultant
Re: Record Count in Transformer
Actually, that was added in the 8.5 release, from what I recall.PhilHibbs wrote:There's no way for the Transformer to know that the current row is the last one.
As you noted, we'd still like to know the "why" of all this, then perhaps we can give a cogent answer.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
-
- Premium Member
- Posts: 1044
- Joined: Wed Sep 29, 2004 3:30 am
- Location: Nottingham, UK
- Contact:
That would involve scripting, or at least shell, we do that withv2kmadhav wrote:Would doing a count and passing it as a param to this job be something that interests you ?
Code: Select all
wc -l
Phil Hibbs | Capgemini
Technical Consultant
Technical Consultant