Call job each 30 minutes

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

fmartinsferreira
Participant
Posts: 142
Joined: Wed Mar 24, 2004 10:51 am
Location: Brazil

Call job each 30 minutes

Post by fmartinsferreira »

I need to make a job that should be called each 30 minutes.

I'm thinking to make a "job batch" and make a loop to call it each 30 minutes, does anyone has any suggestion? :)

Regards,

Fernando
narasimha
Charter Member
Charter Member
Posts: 1236
Joined: Fri Oct 22, 2004 8:59 am
Location: Staten Island, NY

Post by narasimha »

Another option, If you have a external scheduling tool like Contol-M,yada, yada...
You can schedule it there so that the job runs every 30 minutes.
I find this the easiest method :)
Narasimha Kade

Finding answers is simple, all you need to do is come up with the correct questions.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

You could build a Sequence job with the Loop stages that runs your job and sleeps for X inside each iteration.
-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 »

What happens if the job needs 35 minutes to run?

You need to insert a check to determine whether the job is already running.
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 »

Then you just need a smarter sleeper. I wasn't going to add all the gory details, just put forth the general (very) high level concept. :wink:

As an example, I just built one that needs to run over the course of the day and run a series of jobs 'every five minutes'. At the end of each run, regardless of runtime, it sleeps until the next 5 minute mark on the clock. Generally it comes in well under that, but if it does run over then the next 5 minute mark on the clock is the sleep target.
-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 »

Quite.

Create a routine. Use the fact that the SLEEP statement has two syntaxes - one that sleeps for a given number of seconds, the other that sleeps until a particular clock time. Being in a routine, it is easy to calculate the next 30 minute point.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

if memory serves me right you would use the 'NAP' command inside the routine. And the NAP will put the routine to sleep for milliseconds.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Not NAP for sleeping up to 30 minutes! :shock:
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Yea your right, but do we have a SLEEP in Basice. Excuse my ignorance.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Yes, we do. I'm interested in Ray's statement re: two syntaxes... I see no evidence of the ability of being able to sleep until a particular clock time. Where would that be documented?

I went thru some gyrations to compute the next time to sleep to and how many seconds from now that was, hence the interest. :wink:
-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 »

SLEEP hh:mm

Not documented in DataStage BASIC manual.

Been around since the early days of UniVerse, but not documented in UniVerse BASIC manual either.

One of those undocumented features no-one seems to have a list of.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
fmartinsferreira
Participant
Posts: 142
Joined: Wed Mar 24, 2004 10:51 am
Location: Brazil

Post by fmartinsferreira »

more information:

- I don't have a external scheduling tool like Contol-M
- The job do not spend more than 2 minutes

How the question here is very urgent, than I make a "job batch" and put in a for and a sleep. :oops: After I will change this! :)

But the "SLEPP 00:30" doesn't work here, well I have the version 7.5.2.

Regards,

Fernando
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

I think the two sleep syntaxes that Ray is referring to is Sleep n where n is the number of seconds and the other one that he mentioned. But i am not sure about the syntax of SLEEP HH:MM. I am trying to test it but no matter what i put in HH or MM , for some reasons it just sleeps for that amount of seconds.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

As for fmartinsferreira, you can use

Code: Select all

SLEEP 1800
to sleep for 30 minutes.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
fmartinsferreira
Participant
Posts: 142
Joined: Wed Mar 24, 2004 10:51 am
Location: Brazil

Post by fmartinsferreira »

DSguru2B wrote:As for fmartinsferreira, you can use

Code: Select all

SLEEP 1800
to sleep for 30 minutes.
Thats work, but I was trying "SLEPP 00:30" too like Ray talked. :)
Post Reply