Page 1 of 1

Write 0 to sequential file when source DB return 0 records

Posted: Tue Apr 29, 2008 11:57 pm
by Rajee
Hi,

The source for the job is a Sybase database and i am generating the header,footer,body part of a file seperately and then in the after job I am combining the header,body and footer to generate the final outut file.
In addition to that,
1.I need to write message to a log file indicating whether the final output file was generated with record or is empty.
2.I also need to abort the job if the source database returns 0 records.
Both the above functionality can be implemented in the job itself if i could get the record count as 0 in the sequential file when the source database returns no record.But the aggregator returns nothing when the source database returns 0 record and hence the record count sequential file is empty.
Can anyone let me know how a 0 can be append to the file when 0 records are returned from the source database.

Thx,
Rajee

Posted: Wed Apr 30, 2008 1:28 am
by ray.wurlod
Anyone who knows how to use the Search facility in DSXchange could answer that question, as it's been asked before.

But why not search for yourself?

Posted: Thu May 01, 2008 11:08 pm
by Rajee
ray.wurlod wrote:Anyone who knows how to use the Search facility in DSXchange could answer that question, as it's been asked before.

But why not search for yourself? ...
The search gave me the implementation logic through parallel job but iam using server job.

Posted: Fri May 02, 2008 12:36 am
by ray.wurlod
It's the same - detect that 0 rows were sent, and write zero.

Posted: Fri May 02, 2008 12:39 am
by Raghavendra
I have implemented the same kind of logic in server using db2.

I have fired a query using Count(Primary key) first and checked if it is 0 or more. If it is 0, write 0 in the sequential file directly else do the other processing as required.