Loop condition

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
laiko
Premium Member
Premium Member
Posts: 35
Joined: Sun May 25, 2008 10:55 am

Loop condition

Post by laiko »

I need to create a job that waits for a row with the value of current date to appear before the load can proceed. Say, the table is Load_Schedule and it has only one field called 'Load_date'. My job should wait for 1 hour for the Load_date to have a value equal to sysdate before it proceeds to the next stage. How do I do this??
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

What happens if the hour elapses with no such file?

I'd run a job sequence with a loop containing a WaitForFile activity followed by a Job activity to process the file to determine what its date is, then probably a Nested Condition activity to check whether it's the right date.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Except there's no file. :wink:

I'd do something similar in a loop, but rather than WFF call a Server job that checks the table and passes back in USERSTATUS whether the condition was met or not. Add a 'sleep' Routine Activity so it doesn't just race around in the loop at high speed. Branch out of the loop when the condition is met and on to your followup processing steps or let the loop end naturally after your 60 minute window is up and go to your error condition.
-craig

"You can never have too many knives" -- Logan Nine Fingers
laiko
Premium Member
Premium Member
Posts: 35
Joined: Sun May 25, 2008 10:55 am

Post by laiko »

Sorry, forgot to mention it has to wait max 5 hours. I was able to create the sequence however, the problem i see is that everytime the job that checks the table is called, it creates logs. If I have to loop every min for 5 hours, it will create the log 300x (max). Is that a good design???
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

It's probably bearable particularly if you have a short auto-purge interval. Otherwise create your own custom routine or job control code.
Last edited by ray.wurlod on Wed May 27, 2009 4:23 pm, edited 1 time in total.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

I don't see an issue, provided as noted that you stay on top of the runs with an appropriate auto-purge setting.
-craig

"You can never have too many knives" -- Logan Nine Fingers
laiko
Premium Member
Premium Member
Posts: 35
Joined: Sun May 25, 2008 10:55 am

Post by laiko »

Thanks, guys.. That's what am also thinkin' - purge regularly.
Post Reply