Abort if the source table has zero 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
paranoid
Premium Member
Premium Member
Posts: 185
Joined: Tue May 29, 2007 5:50 am

Abort if the source table has zero records

Post by paranoid »

Hi,

We have a requirement in our project where we need to abort a job When the rowcount of the source table is zero.

could you please let us know how to check the table source count in transformer stage and based on that condition aborting a job?

Thanks
Sue
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

The short answer is that you cannot check the row count for 0 in the transform stage, as processing doesn't go there.
There are several methods commonly used to do this, but this depends upon the nature and type of your source data. With database tables as sources, an external "SELECT COUNT(*)" call is often used, either in the before-job processing or in the calling job sequence.
I would prefer to call the job from a sequence, and after the job finishes I would use the DSGetJobInfo() calls to see how many rows came from the source and then trigger an abort from the job sequence if the value is 0.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

I would follow Arnd's logic, but avoid aborting (because I always do). If the count is zero, it should suffice to log a message, maybe send an email, and then simply not execute the remainder of the sequence. Maintain control!
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
paranoid
Premium Member
Premium Member
Posts: 185
Joined: Tue May 29, 2007 5:50 am

Post by paranoid »

Thank you so much!!
Post Reply