Run the job mutliple times untill the condition is met

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
sravanthi
Participant
Posts: 83
Joined: Fri Jun 02, 2006 5:37 am

Run the job mutliple times untill the condition is met

Post 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!
sravanthi
nagarjuna
Premium Member
Premium Member
Posts: 533
Joined: Fri Jun 27, 2008 9:11 pm
Location: Chicago

Post 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
Nag
kris007
Charter Member
Charter Member
Posts: 1102
Joined: Tue Jan 24, 2006 5:38 pm
Location: Riverside, RI

Post by kris007 »

Write a simple Sleep routine and include it in your loop. That should do it.
Kris

Where's the "Any" key?-Homer Simpson
vivekgadwal
Premium Member
Premium Member
Posts: 457
Joined: Tue Sep 25, 2007 4:05 pm

Post 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...
Vivek Gadwal

Experience is what you get when you didn't get what you wanted
Post Reply