Page 1 of 1
Count Of records
Posted: Tue Nov 23, 2010 4:25 am
by dr.murthy
Hi ,
How to get a count of records in a file and process this count to next stage.
Posted: Tue Nov 23, 2010 5:14 am
by Sreenivasulu
1.Open sequencer
2.use execute command activity
3.wc - l <file name>
Regards
Sreeni
Posted: Tue Nov 23, 2010 5:32 am
by dr.murthy
Thanks for respond, i need to find count of records in a datastage server job
Posted: Tue Nov 23, 2010 6:04 am
by ArndW
DataStage stages are designed so that they execute one row at a time, so your requested approach poses some difficulties so that it doesn't get executed once per row.
The best was has alread been suggested, to get the count in a job sequence and then pass that value as a parameter to your job.
In your case you might just read your file in a sequential stage, then perform an aggregation to get a row count and then pass that value on to the next stage.
Posted: Tue Nov 23, 2010 6:57 am
by chulett
While you are reading/processing it? Aggregator. Before or afterwards? Sequence job as noted.
Posted: Tue Nov 23, 2010 6:58 am
by dr.murthy
In aggregaator is possible to count number of records in a link??
Posted: Tue Nov 23, 2010 7:01 am
by chulett
You would send a single non-null field down another link to the Aggregator and tell it to count that. Doesn't even have to be a "real" field, you could hard-code a value.
Posted: Wed Nov 24, 2010 2:10 am
by dr.murthy
i need this count in a same link, lets mf src file have two fields A and B, then tgt contain three fileds A and B And C, aditional field contains Count of records passing on that link.
Posted: Wed Nov 24, 2010 2:41 am
by Sreenivasulu
You can use @INROWNUM to get the rowcount
Posted: Wed Nov 24, 2010 3:30 am
by dr.murthy
inrow num it doesnot give count the number of records
Posted: Wed Nov 24, 2010 6:45 am
by chulett
'Count of records passing on that link'? That would always be 1 unless you are doing aggregation based on the two fields... are you?
If so, then an inline Aggregator can do the grouping and counting for you. If you need to do something else, then please be more specific in your problem description.
Posted: Wed Nov 24, 2010 3:12 pm
by ray.wurlod
dr.murthy wrote:inrow num it doesnot give count the number of records
Yes it does.
Posted: Wed Nov 24, 2010 4:24 pm
by chulett
ray.wurlod wrote:dr.murthy wrote:inrow num it doesnot give count the number of records
Yes it does.
So far, and the last one has the total.
![Wink :wink:](./images/smilies/icon_wink.gif)