Getting record count from Transformer

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
aaikat
Participant
Posts: 47
Joined: Tue Mar 07, 2006 2:49 am

Getting record count from Transformer

Post by aaikat »

I have 2 source tables followed by Join stage(outer join),followed by Transformer stage which branches data into 4 output sequential files.
Now I want to calculate the total records coming into Transformer stage and write it to a sequential file.
I used a stage variable 'TotalCounts' in Transformer, set its initial value to 0 and in derivation 'TotalCounts + 1'
But when I am looking at the output the TotalCounts values written to the file gets recycled after some interval. Please suggest how it can be done.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

System variable @INROWNUM maintains the count of rows on the input link, while each output link maintains its own @OUTROWNUM (on each partition in each case). You could collect these into an extra two columns on each output link, and use downstream Copy stages to split them out, and Aggregator stages (perhaps in Sequential mode) to report the Max of each.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
aaikat
Participant
Posts: 47
Joined: Tue Mar 07, 2006 2:49 am

Post by aaikat »

I am not clear about how to collect these.Will you plz elaborate.
I dbout due to partitioning I am not getting the correct count.
say there are 1000 input record counts
the variable doesn't show 1,2,3....,1000
Rather it is showing 1,2,3,...100,1,2,3,....
How to get rid of that.
richdhan
Premium Member
Premium Member
Posts: 364
Joined: Thu Feb 12, 2004 12:24 am

Post by richdhan »

Hi aaikat,

After join stage have a copy stage to branch the records to a transformer and an aggregator(in sequential mode) to get the record count.

HTH
--Rich
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

Are you getting the numbers for each partition, then you should be able to make up with the combinations of followings @PARTITIONNUM,@NUMPARTITIONS,@INROWNUM
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
kool78
Participant
Posts: 104
Joined: Sat Aug 20, 2005 2:02 pm

Post by kool78 »

Hi

Set the Transformer mode to Sequential and assign the system variable @INROWNUM to the column which u want to hold the count, then aggregate upon the column and get the max of it, that would be your number of records from source.
prabu
Participant
Posts: 146
Joined: Fri Oct 22, 2004 9:12 am

Re: Getting record count from Transformer

Post by prabu »

aaikat wrote:I have 2 source tables followed by Join stage(outer join),followed by Transformer stage which branches data into 4 output sequential files.
Now I want to calculate the total records coming into Transformer stage and write it to a sequential file.
I used a stage variable 'TotalCounts' in Transformer, set its initial value to 0 and in derivation 'TotalCounts + 1'
But when I am looking at the output the TotalCounts values written to the file gets recycled after some interval. Please suggest how it can be done.
have you tried DSGetLinkInfo (JobHandle, StageName, LinkName, InfoType)??
Post Reply