Page 1 of 1

Run the job mutliple times untill the condition is met

Posted: Fri Sep 24, 2010 9:08 am
by sravanthi
Hi,

I have a situation where i have to query a table and look for a column.It is 'A' then proceed to another job.

I have to keep running the job until the column value is 'A'. Another process outside of etl updates this table..

Now how can i run the job every 5 min to check the value for "A". I have used start loop..>job activity..>end loop.

I'm checking for user status of this job as trigger...but the job is completed and it is exiting of the loop..How can i implement this in sequencer.

Thanks for your help!

Posted: Fri Sep 24, 2010 10:39 am
by nagarjuna
If I understand it correctly , you can do by writing a unix script to check the value of that column and if its equal to A proceed to dsjob -run or else wait for sometime ..You need to write while loop i guess

Posted: Fri Sep 24, 2010 2:21 pm
by kris007
Write a simple Sleep routine and include it in your loop. That should do it.

Posted: Fri Sep 24, 2010 2:32 pm
by vivekgadwal
If you want a DataStage solution, look into UserStatus here. The way you would do it is, you will need to have separate jobs to achieve what you want and these should be part of the sequence.

The below steps will be part of a loop that would run based on the time interval that you give (look into 'Sleep' function, use it in a routine). The loop variables are something that you could provide, say 1 through 1000 or something like that (these will be your sequence parameters - set in the job properties of the sequence)

Step-1: In one job you query your DB to get the value of the field (whether it be 'A' or something else). In the same job you will set the user status to whatever this value would be.

Step-2: Using User Variable activity in the sequence, set a variable value to this user status

Step-3: Nested Condition activity checks if this is the value you need (in your case - 'A'). Two triggers should be given from this activity...one will say if the value is not 'A' then loop back and the other will say if the value is 'A', then run the job that has to be run (separate activity)

I am describing this as I see it on top of my head (not having DS) and I am hoping this should set you on the path...