Count Of records

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
dr.murthy
Participant
Posts: 224
Joined: Sun Dec 07, 2008 8:47 am
Location: delhi

Count Of records

Post by dr.murthy »

Hi ,

How to get a count of records in a file and process this count to next stage.
D.N .MURTHY
Sreenivasulu
Premium Member
Premium Member
Posts: 892
Joined: Thu Oct 16, 2003 5:18 am

Post by Sreenivasulu »

1.Open sequencer
2.use execute command activity
3.wc - l <file name>

Regards
Sreeni
dr.murthy
Participant
Posts: 224
Joined: Sun Dec 07, 2008 8:47 am
Location: delhi

Post by dr.murthy »

Thanks for respond, i need to find count of records in a datastage server job
D.N .MURTHY
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

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

Post by chulett »

While you are reading/processing it? Aggregator. Before or afterwards? Sequence job as noted.
-craig

"You can never have too many knives" -- Logan Nine Fingers
dr.murthy
Participant
Posts: 224
Joined: Sun Dec 07, 2008 8:47 am
Location: delhi

Post by dr.murthy »

In aggregaator is possible to count number of records in a link??
D.N .MURTHY
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

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

"You can never have too many knives" -- Logan Nine Fingers
dr.murthy
Participant
Posts: 224
Joined: Sun Dec 07, 2008 8:47 am
Location: delhi

Post 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.
D.N .MURTHY
Sreenivasulu
Premium Member
Premium Member
Posts: 892
Joined: Thu Oct 16, 2003 5:18 am

Post by Sreenivasulu »

You can use @INROWNUM to get the rowcount
dr.murthy
Participant
Posts: 224
Joined: Sun Dec 07, 2008 8:47 am
Location: delhi

Post by dr.murthy »

inrow num it doesnot give count the number of records
D.N .MURTHY
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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.
-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 »

dr.murthy wrote:inrow num it doesnot give count the number of records
Yes it does.
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 »

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

"You can never have too many knives" -- Logan Nine Fingers
Post Reply