Write 0 to sequential file when source DB return 0 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
Rajee
Participant
Posts: 46
Joined: Thu Mar 13, 2008 7:06 am
Location: India

Write 0 to sequential file when source DB return 0 records

Post 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
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Rajee
Participant
Posts: 46
Joined: Thu Mar 13, 2008 7:06 am
Location: India

Post 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.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

It's the same - detect that 0 rows were sent, and write zero.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Raghavendra
Participant
Posts: 147
Joined: Sat Apr 30, 2005 1:23 am
Location: Bangalore,India

Post 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.
Raghavendra
Dare to dream and care to achieve ...
Post Reply