Page 1 of 1

How to Schedule a Job thru DS Programming...

Posted: Thu Jul 31, 2003 1:17 am
by devaraj4u
Dear All,
I have a Job called (LOADLRRPoolOpics).We are running that job using DataStage Director assume(Job ---> Run Now Option)...I know that we can schedule this job using Menu Opt(Job ---> Add to Schedule).
But I want to do that Programmatically(DS Programmint),Ray could you please help me on this issue...

Thanks & Regards,
K.S.Rajan.

Posted: Thu Jul 31, 2003 6:20 am
by chulett
Perhaps you could explain why you have a need to do this? Typically, 'scheduling' is something done once for a job, not dynamically. Are you sure you don't need to 'programmatically' *run* other jobs, not simply schedule (or reschedule, I assume) them?

-craig

Posted: Thu Jul 31, 2003 4:51 pm
by ray.wurlod
Simplistically, you could have a control job that sleeps until the desired time (SLEEP hh:mm) then calls DSRunJob. I take it that's not what you have in mind.
Again it's not clear why you want to reinvent the wheel. What's wrong with the facilities provided with DataStage?
There is a subroutine called DSR_SCHEDULE, but how to call it is not in the public domain. You could probably work this out by enabling server side tracing and scheduling a job, then reviewing the output of the trace. Then again, this may work indirectly, via the DSR.SCHED command. Who knows? This is not documented, because the vendor expects you to use the documented facilities.

Ray Wurlod
Education and Consulting Services
ABN 57 092 448 518

Posted: Tue Oct 28, 2003 3:30 am
by JeanPierreHaddad
Hello Everyone

I see the problem quite clearly because I have a similar situation. I will explain:
1. My control job runs jobs which use tables which are updated at the beginning of the week.
2. Before running these jobs I check if the tables have been updated and are available.
3. If the tables are not ready then I want to run the control job 24 hours later.

So this is a dynamic decision to schedule a job, based on the results of a checking. Without reinventing the wheel I would like to know what are the existing tools or commands available for this task.

Thank you for your help.
Jean-Pierre Haddad

Posted: Tue Oct 28, 2003 4:13 am
by roy
Hi,
in any case you have to/ want to use your own scheduall algoritims,
simply use external schedualling via OS or even scripts depending on your OS (i.e. vbscript on windows or shell scripts on unix which uses the dsjob command line to run jobs)

in case of the 3rd point mentioned by Jean-Pierre Haddad
you can use the at, command line, for instance, to manually schedual a 1 time run in the future designated date/time.

this is going outside the tool, I agree, but it does the job :)

there are more things to take in concideration depending on the specific circumstances at hand.

I'm sure if you run in to more difficulties you'll post here.

p.s.
I had some projects that needs to run ds jobs in intervals smaller then 1 hour let alone 1 day, unfortunatly DS Director supports schedualling in 1 day intervals at best, so a bit of os programing encapsulation and it is done 8)

IHTH (I Hope This Helps)

Re: How to Schedule a Job thru DS Programming...

Posted: Tue Oct 28, 2003 9:03 am
by kcbland
All job execution is accessible through the dsjob command line executable. This is your gateway to running a job from any scheduling touch. DataStage provide's a vanilla maintenance screen to cron or AT (depends on platform). You can write any scheduling logic you want from any language (shell script, c, ksh, perl) if you simply use a system call to dsjob.

There's nothing fancy going on there. If you read your online documentation on the command line, you will se that it is very feature rich and has just about everything you need.

Re: How to Schedule a Job thru DS Programming...

Posted: Tue Oct 28, 2003 4:39 pm
by ray.wurlod
devaraj4u wrote:Dear All,
I have a Job called (LOADLRRPoolOpics).We are running that job using DataStage Director assume(Job ---> Run Now Option)...I know that we can schedule this job using Menu Opt(Job ---> Add to Schedule).
But I want to do that Programmatically(DS Programmint),Ray could you please help me on this issue...

Thanks & Regards,
K.S.Rajan.
That sounds distinctly like a request for my professional services. Please respond off line if that is what you seek. My rates are quite reasonable.

It definitely can be done; I implemented quite a complex scheduler earlier this year in India, where the control and dependency rules were stored in an Oracle table. The scheduler was, nonetheless, implemented entirely within DataStage BASIC.

Re: How to Schedule a Job thru DS Programming...

Posted: Fri Oct 31, 2003 2:31 am
by JeanPierreHaddad
Hello,

Ray I don't want to compete with you on consulting services. I am quite happy with my present employer. :-) But since my last posting which revived a subjec left dormant for a while I designed a simple scheduler in BASIC which reads an ORACLE table. This table contains the information required to run a job at a given time, much like a multitasking operating system would do. This scheduler is the only job which remains in the DataStage scheduler and runs once every hour (my requirements are satisfied). The calls for the scheduler services are initiatied by the jobs themselves which check on certain conditions (tables ready, indexes, other jobs running...) then they decide whether to run or/and to recycle themselves in a determined period.

Have a great day
Jean-Pierre