How to Schedule a Job thru DS Programming...

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
devaraj4u
Participant
Posts: 32
Joined: Mon Nov 11, 2002 12:32 am
Location: Schaumburg,Chicago

How to Schedule a Job thru DS Programming...

Post 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.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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
JeanPierreHaddad
Participant
Posts: 18
Joined: Mon Nov 25, 2002 3:23 am
Location: Switzerland

Post 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
roy
Participant
Posts: 2598
Joined: Wed Jul 30, 2003 2:05 am
Location: Israel

Post 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)
Roy R.
Time is money but when you don't have money time is all you can afford.

Search before posting:)

Join the DataStagers team effort at:
http://www.worldcommunitygrid.org
Image
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

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

Post 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.
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

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

Post 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.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
JeanPierreHaddad
Participant
Posts: 18
Joined: Mon Nov 25, 2002 3:23 am
Location: Switzerland

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

Post 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
Post Reply