Delay or Wait in Job Sequence
Moderators: chulett, rschirm, roy
Delay or Wait in Job Sequence
Does anyone have any suggestions as to how I could incorporate a variable-length delay into a job sequence?
Specifically, what I'm trying to do is start a job sequence at a random time on a particular day, run up to the last activity in the sequence at normal speed, then delay execution of that last activity until 2:00 AM the next day.
Assume I know the time and date I started the sequence because I've passed that in as a string-type sequence parameter. Don't worry about special situations such as running through midnight.
Any ideas?
TIA,
tpb
Specifically, what I'm trying to do is start a job sequence at a random time on a particular day, run up to the last activity in the sequence at normal speed, then delay execution of that last activity until 2:00 AM the next day.
Assume I know the time and date I started the sequence because I've passed that in as a string-type sequence parameter. Don't worry about special situations such as running through midnight.
Any ideas?
TIA,
tpb
-
- Participant
- Posts: 3337
- Joined: Mon Jan 17, 2005 4:49 am
- Location: United Kingdom
Thanks for your prompt reply!
The problem using sleep() is how to calculate the number of seconds.
I'd have to know the difference in seconds between 0200 the next day and now. "Now" is a known quantity, but how would you go about calculating the desired start time? All the nice time and date functions that are available inside a parallel job aren't available to the sequence.
tpb
The problem using sleep() is how to calculate the number of seconds.
I'd have to know the difference in seconds between 0200 the next day and now. "Now" is a known quantity, but how would you go about calculating the desired start time? All the nice time and date functions that are available inside a parallel job aren't available to the sequence.
tpb
-
- Participant
- Posts: 3337
- Joined: Mon Jan 17, 2005 4:49 am
- Location: United Kingdom
Well, it looks as if I was a bit premature in my celebration. At least I learned something new today (IConv).
Sleep cannot be used in expressions, which is where I was planning to use it (as the condition for a trigger to the next stage.)
So I am back to step one - how can I force a processing delay of arbitrary length between jobs in a parallel job sequence?
tpb
Sleep cannot be used in expressions, which is where I was planning to use it (as the condition for a trigger to the next stage.)
So I am back to step one - how can I force a processing delay of arbitrary length between jobs in a parallel job sequence?
tpb
Still think sleep would be your best bet. Write a routine to do the sleeping and use a Routine Activity stage to run it rather than trying to delay in the trigger.
It could even check the current time or job start time as an argument and sleep a computed length of time, I would think.
It could even check the current time or job start time as an argument and sleep a computed length of time, I would think.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
The SLEEP statement has two formats.
But the second format only works within a day. If hh:mm is in the past, SLEEP does not wait. To sleep until 02:00 you need to resort to something like:
Or, of course, you can calculate the number of seconds
Code: Select all
SLEEP seconds
SLEEP hh:mm
Code: Select all
SLEEP 23:59
SLEEP 120
SLEEP 02:00
Code: Select all
SLEEP 86400 - Time() + 7200
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.