Keep Sequencer waiting to trigger a job at a particular time

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
suja.somu
Participant
Posts: 79
Joined: Thu Feb 07, 2013 10:51 pm

Keep Sequencer waiting to trigger a job at a particular time

Post by suja.somu »

A Sequence job is scheduled to trigger daily at 10 PM and it runs multiple jobs . There is one Parallel DataStage job(say X) in that sequence that has to run at a particular time at 2 AM. Even if the Preceding jobs finish early before 2 AM, the sequence job should keep running and wait till 2 AM to trigger the job X . If the Preceding jobs finish later than 2 AM, the sequencer should exit . How I can do this ?
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Check whether the time is after 10PM and earlier than 2AM (e.g. User Variables activity). If it is, execute a sleep command to wait until 02:00 then run the job. If it is after 2AM, then bypass that logic. Both streams of logic end up in the same Any sequencer.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
ith0021
Premium Member
Premium Member
Posts: 1
Joined: Sat Jul 16, 2016 5:21 pm

Re: Keep Sequencer waiting to trigger a job at a particular

Post by ith0021 »

Ray provided the solution..

Another option would be, take out the 'X' job from the main sequence job.
Schedule the main sequence job to run at 10 pm and once it is completed touch 'mainsequencejob.Done' file.
Also schedule the 'X' job to run at 2 AM and have a wait for file activity to check the 'mainsequencejob.Done' file, if it is there continue to run the 'X' job or dont execute the job.
Karthik
suja.somu
Participant
Posts: 79
Joined: Thu Feb 07, 2013 10:51 pm

Post by suja.somu »

Thanks Ray and Karthik for the response.

Currently I am checking the time in a shell script and executing the Job, it works fine. I want to simplify the design to get rid of shell script and also I don't want to use touch or done file.

I am more inclined towards Ray solution. Could you please elaborate on the first step : how to check time in User Variable activity?

Also , Sleep HH:MM in the execute command stage failed with a error " invalid time interval "

Even on the Linux box , the error is as below
sleep: invalid time interval `02:00'


Version: DataStage 11.5 on RHEL LINUX

Please help.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Just going to address the "Also". That sleep sleeps for an amount of time, by default in seconds, not until a specific time, which is why you got that interval error. So you would need to get the current time as Ray noted and then compute the number of seconds (or minutes) until your target time, then sleep for that interval.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Within DataStage BASIC programming language SLEEP hh:mm is permitted, so you can effect this with a very simple one-line routine.

(Avoid Execute Command - every time you use it you carry the overhead of opening a new shell and starting any processes required in it.)
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Code: Select all

Oconv(@TIME, "MT") >= "22:00" Or Oconv(@TIME, "MT") <= "02:00"
System variable @TIME is set when the job starts. If that's not what you want, the Time() function returns the system time when invoked.

A user variable with the above derivation will return 1 (true) or 0 (false), which you can test in any downstream activity.
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 »

Ah yes... forgot about the whole BASIC versus UNIX aspect of sleeping. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply