Page 1 of 1

Running Jobs from Routines

Posted: Wed Jul 27, 2005 5:24 am
by goosarikiran
Can we run jobs from Routines?

Posted: Wed Jul 27, 2005 6:16 am
by ArndW
Yes, you can run jobs easily from routines.

Posted: Wed Jul 27, 2005 6:19 am
by ArndW
Sorry, I was being a typical consultant - I answered your question but didn't help you at all :D

You need to use DataStage routines to call jobs from routines.

1. DSAttachJob() to "open" the job for use
2. DSPrepare() [optional] to prepare a perhaps aborted job
3. DSSetParam() [optional] to set parameter values
4. DSRunJob() to actually run the DataStage job
5. DSWaitForJob() [optional] to wait for the job to complete

There are other routines which you might want to use, but these are the normal ones. The Basic Programmer's guide will describe all of these routines in detail.

If you wish an example, create a Sequencer and do one job activity. Then in the Director look at the Job Control tab to get an example of how these calls work.

Posted: Wed Jul 27, 2005 10:15 am
by kduke
There is a routine supplied by IBM to do it. UtilityRunJob.

Posted: Wed Jul 27, 2005 6:02 pm
by vmcburney
You have Enterprise Edition of DataStage, and you probably work in parallel jobs, you use the Parallel Job Developers Guide to build those jobs. Ascential have cunningly hidden job control documentation in the Server Job Developers Guide, even though it pertains to all job types and not just server jobs. Open up the Server Job Developers Guide and peruse the chapter on BASIC programming, especially the section on job control.

An even easier way to work it out is to create a batch job. These old dinosaurs are created from the Director Tools - Batch menu and they come with a combo box that lists all jobs, when you choose a job and hit the "Add Job" button it dumps all the code into the code box for running the job. You can then copy and paste it to a routine and modify it to make it more generic.

Posted: Wed Jul 27, 2005 9:31 pm
by ray.wurlod
Ascential have cunningly hidden job control documentation in the Server Job Developers Guide
That's because a job sequence is just a special case of a server job. :D