IBM Information Server - How to run the jobs on condition

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
Chandrathdsx
Participant
Posts: 59
Joined: Sat Jul 05, 2008 11:32 am

IBM Information Server - How to run the jobs on condition

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

Post 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.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Chandrathdsx
Participant
Posts: 59
Joined: Sat Jul 05, 2008 11:32 am

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

Post 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.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply