Page 1 of 1

IBM Information Server - How to run the jobs on condition

Posted: Sat Jul 05, 2008 12:45 pm
by Chandrathdsx
Hello,

I am trying to run job1 or job2 based on existance of data in a table. For example, if there is data in a table XYZ for selection criteria then run job1, if there is no data in table XYZ then run job2? Can any one please help me with this (with an example, would be a great) in IBM information server on Unix environment.

I tried using job activity, custom (conditional ) expression. But I do not know exactly how to use this.
Any help is highly appreiciated.

Thanks
Chandu.

Posted: Sat Jul 05, 2008 3:23 pm
by ray.wurlod
When you draw an arrow from one activity to another, there is an extra tab on the upstream activity called "Trigger". Some "canned" triggers are available, for example "OK", "Warning" and "Failure", and you can create your own custom triggers using the expression builder.

In your specific case, you would probably have an intermediate activity that tests for whether there are zero rows in table XYZ and use that trigger to determine whether to run Job2.

Posted: Sat Jul 05, 2008 10:08 pm
by Chandrathdsx
Ray, I am looking for the code that has to be typed under triggers tab/ expression field to trigger job1 if there is data in the table and trigger job2 if there is no data. Please let me know the details what has to be given in the expression field of triggers tab.

Thanks.

Posted: Sun Jul 06, 2008 7:58 am
by ray.wurlod
You can not rely on Job1. Job1 (except through use of an after-job subroutine) can only report the number of rows it sent to table XYZ, not how many were successfully inserted. You have to do something in between to test how many rows the table has. This could be a command or a routine, or another job, or the after-job subroutine as mentioned.