Check for DW connection before running the job sequences

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

Check for DW connection before running the job sequences

Post by kris007 »

Hi All,

I would like to develop a job which checks for the datawarehouse connection and sees if its up and running before it triggers my job sequences. And, if the datawarehouse in not available I would like this job to wait for some time before it checks for the connection again and then triggers my job sequences. One way I can think of is to execute a sql statement like
"select sysdate from dual"
and see if the DW is up or not. But I am scratching my head on how to make it wait(sleep) for some time before it tries to check the connection again. It would be great if anyone could suggest me some ideas or direction and also let me know if this is a good practise to do.

Thanks
Kris[/code][/quote]
rasi
Participant
Posts: 464
Joined: Fri Oct 25, 2002 1:33 am
Location: Australia, Sydney

Post by rasi »

Kris

Seach on this forum for Wait for File Activity or poll. This has been discussed before
Regards
Siva

Listening to the Learned

"The most precious wealth is the wealth acquired by the ear Indeed, of all wealth that wealth is the crown." - Thirukural By Thiruvalluvar
kris007
Charter Member
Charter Member
Posts: 1102
Joined: Tue Jan 24, 2006 5:38 pm
Location: Riverside, RI

Post by kris007 »

I did search on it, but my requirements here are quite different just waiting for file wont do,sorry for not being specific earlier. I would like to connect to Database for every min or so (loop activity) until i get the connection to oracle I want to keep tryin say like atleast 5 times or (few min).

P.S my server is Windows
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

If you're on 7.5x2 you can use StartLoop and EndLoop activities in your job sequence.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
kris007
Charter Member
Charter Member
Posts: 1102
Joined: Tue Jan 24, 2006 5:38 pm
Location: Riverside, RI

Post by kris007 »

Ray,

I can use StartLoop and EndLoop.But, if the DW is down I need my job to wait for sometime and check for it again. For that, I am assuming I need to write a routine for a wait time. Am I thinking right. To be more clear, when the loop starts and if my DW is up the next jobs in the sequence run. But if my DW is down, then the job which checks for DW connection fails and the output should go to a routine or a function where it needs to wait for say like 10 min before starting the loop again. I didnt find any routine which can do this. Is there one or do we need to write our own routine. If so, can I get some guidance in writing the routine.

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

Post by chulett »

Use the Wait For File stage set to look for a non-existant file and then to give up after your desired 'sleep' time.
-craig

"You can never have too many knives" -- Logan Nine Fingers
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

A job to check the connections can be made by the command you had mentioned
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
kris007
Charter Member
Charter Member
Posts: 1102
Joined: Tue Jan 24, 2006 5:38 pm
Location: Riverside, RI

Post by kris007 »

Thanks Craig. That works, but only if I dont use the ExceptionHandler. I am assuming that it works that way because I am handling the errors by giving a Failed trigger.

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

Post by chulett »

Yes, because the Wait For File stage has to 'fail' when it doesn't find a file it can trigger the Exception Handler. A couple of things you can do about that -

1) Try using either an 'Unconditional' trigger instead of a Failed one or two triggers, an Ok and an Otherwise so that it thinks you are handling any exceptions so it doesn't need to.

2) Replace the Wait For file with a Routine Activity that calls a custom Sleep X Seconds routine. Minimum code would be all of:

Code: Select all

sleep Arg1
Ans=0
Of course, you may want to make it... smarter... than that. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
kris007
Charter Member
Charter Member
Posts: 1102
Joined: Tue Jan 24, 2006 5:38 pm
Location: Riverside, RI

Post by kris007 »

Thanks Craig. That helped.

Kris. :)
Post Reply