number of records in source

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
mohanraj
Participant
Posts: 48
Joined: Sat Mar 25, 2006 12:40 am
Location: bangalore

number of records in source

Post by mohanraj »

hi to all

can anyone tell me how can i count number of records in source(flat file)

Thanks in advance

cheers.....
raju
loveojha2
Participant
Posts: 362
Joined: Thu May 26, 2005 12:59 am

Post by loveojha2 »

Pass source data through a transformer, pass one column from source link, and pass one more column within the transformer (mark it as key) to the output link from the transformer.
Provide derivation as @OUTROWNUM for this column, pass this link to aggregator stage and use count function within the output link of the aggregator stage. This will give you the count of the source rows.
Success consists of getting up just one more time than you fall.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

The @INROWNUM system variable gives you this count as each row is processed. Therefore in the last row it has the total number of rows in the source file.

Pass this through an Aggregator stage with either Last or Max as the aggregation function (Last is more efficient) to get just that number output.

Or you can pass any non null column through an Aggregator with the Count function.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply