Trigger a Warning To Log if Data Source returns no rows

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
charlesbishop
Participant
Posts: 2
Joined: Fri Jul 30, 2004 2:30 am

Trigger a Warning To Log if Data Source returns no rows

Post by charlesbishop »

Wondering if anyone has any suggestions for getting a job to generate a warning if there are no rows returned from the source. Ideally I don't want to do this from a controlling job, but within the job at runtime?

I have tried a constraint on INROWNUM but the job seems to complete succesfully by default.
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

Does it imply that the source is empty or whether there are no records to be loaded into the target?

You can check the link row count after your job finishes.

Search for Link Row Count in this forum for more details.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

You could call an after-job routine, passing it the @OUTROWNUM; then have the routine call DSLogWarn to issue a warning message to the log. It is essentially a one-liner.
talk2shaanc
Charter Member
Charter Member
Posts: 199
Joined: Tue Jan 18, 2005 2:50 am
Location: India

Post by talk2shaanc »

Code: Select all

Wondering if anyone has any suggestions for getting a job to generate a warning if there are no rows returned from the source. Ideally I don't want to do this from a controlling job, but within the job at runtime? 

I have tried a constraint on INROWNUM [color=red]but the job seems to complete succesfully by default[/color].
what i understood from you requirement, is you dont want to start the current job, if your source is empty. Right ?
If my uderstanding is correct, then in the same job its not possible, you will have to have a job control
OR
Write a before job routine, check for size of the source file, if its 0byte then ABORT, logging message in the log file 'Source is empty'
OR
Write a before job routine, check for size of the source file, if its 0byte then log a warning message in the Director log and let the process move forward, without doing anything.
Shantanu Choudhary
charlesbishop
Participant
Posts: 2
Joined: Fri Jul 30, 2004 2:30 am

Post by charlesbishop »

Thanks for reply's.

I have used the call to DSGetLinkInfo with InfoType DSJ.LINKROWCOUNT in an After-Job Subroutine and then call DSLogWarn if the result is 0.

Works okay, great.
Post Reply