Page 1 of 1

Zero count

Posted: Wed May 26, 2010 7:48 pm
by datastagenewbie
:?: I have a situation where i count the records in a file and when the file is empty I need the count to be zero. But In DataStage it is not outputting anything. :cry:
Please advise.

Posted: Wed May 26, 2010 9:59 pm
by ray.wurlod
Yes, that seems like a reasonable requirement.

What do you get out of DataStage when there ARE records in the file? How are you calculating this?
Think about how any calculation could be performed if no records are passing through the job.

What you need to do is to detect whether the file is empty (perhaps in a Routine activity, perhaps in an Execute Command activity). Based on that result, either write 0 to the target or run the DataStage job.

Posted: Thu May 27, 2010 7:29 am
by datastagenewbie
To get the count, I am creating a dummy key column and counting it in the aggregator.
As a workaround I am having a row generator generate a zero value, and add it to the count from the aggregator(above).
So, even if nothing is in the file the value will be zero.

Posted: Thu May 27, 2010 7:31 am
by datastagenewbie
ray.wurlod wrote:Yes, that seems like a reasonable requirement.

What do you get out of DataStage when there ARE records in the file? How are you calculating this?
Think about how any calculation could be performed ...
I am not a premium member, so I don't know if you already provided the solution or not...sometimes I wish I was a premium member. :-(

Posted: Thu May 27, 2010 11:11 am
by ray.wurlod
datastagenewbie wrote:sometimes I wish I was a premium member. :-(
That, at least, is easily remedied.

Re: Zero count

Posted: Thu May 27, 2010 1:08 pm
by vinnz
datastagenewbie wrote::?: I have a situation where i count the records in a file and when the file is empty I need the count to be zero. But In DataStage it is not outputting anything. :cry:
Please advise.
Are you doing your counting in an Aggregator stage or outside of DataStage? Can you use an operating system command (you should have MKS installed) like 'wc -l' ?

Posted: Wed Oct 20, 2010 10:03 pm
by prasad v
I am also facing the same issue. Can anybody tell me the answer if it is resolved?

Regards
Prasad