Page 1 of 1

job control

Posted: Wed Mar 16, 2005 8:38 pm
by naren6876
Hi
How to write a Job Control Routine?.From any server job can we control other jobs?
pls explain

thanks,
naren

Posted: Wed Mar 16, 2005 8:43 pm
by kcbland
Go into DataStage Director. From the menu, do Tools --> Batch ---> New.

This opens a dialog box that allow you to create a "Batch" type job. From the Add Job pull down box, experiment and choose a job. You will see job control logic appear in your properties box. Press the Close button and the job will compile. These jobs will appear in Director under the names "Batch::...".

Look at the logic that was created in the job by opening it again. Tools --> Batch ---> Open. You can add as many jobs as you want, customize the logic, etc. Eventually, you will take the standard instructions for running a job, and put them in your own DS Manager Function. You will be able to write more complete and comprehensive job control yourself, using the document DS* APIs in your DS BASIC manual.

Posted: Wed Mar 16, 2005 8:47 pm
by bchau
Job control allows you to run different jobs, kinda like a job sequencer. The plus of using job control is that you can run loops for a specific job, specifying different inputs via job parameters. Say, you had several source files but you want to apply the same mapping or transformation to each one of the sources. You could use job control to run the same job several times (once for each source file by changing the job parameters in the job control code).

I'm still quite new to datastage, but I don't believe this can be done in a job sequencer unless you make a job for each source file (can be tedious).

Posted: Wed Mar 16, 2005 9:07 pm
by kcbland
bchau wrote: I'm still quite new to datastage, but I don't believe this can be done in a job sequencer unless you make a job for each source file (can be tedious).
Ohayo gozaimasu. The Sequencers graphical metaphor basically requires an icon per job controlled. This works well for just a few jobs in a jobstream. But, 300 jobs in a jobstream is unmanageable, unless you begin layering Sequencer jobs over Sequencer jobs in a nested structure. You're better off writing intelligent job control in the long run to do the things you want done.

Posted: Wed Mar 16, 2005 9:19 pm
by naren6876
Hi

I have a multiple files in a sequential file. Based on on the filename can i call the jobs?. Is it possible in job control logic?.If so ,explain me bit more


Thanks,
naren

Posted: Wed Mar 16, 2005 9:57 pm
by kcbland
You can do anything. There are documented APIs to lock, set, and run jobs according to the methods you want. Do you want to read a file, get a list of jobnames to run, run those jobs, send emails letting people know jobs are done, compress and cleanup your work area? All it takes is planning what you want to do, drawing up a technical specification, coding a Batch job with supporting Functions that utilize the DS BASIC job control APIs, and then writing your operational procedures.

Anything is possible, you need to decide what you want to do.

Posted: Wed Mar 16, 2005 10:28 pm
by naren6876
Exactly. Thats what i want to do?.Can you help to implement that logic Ken?If possible can you give me some sample code please.
Thanks,
Naren
kcbland wrote:You can do anything. There are documented APIs to lock, set, and run jobs according to the methods you want. Do you want to read a file, get a list of jobnames to run, run those jobs, send emails letting people know jobs are done, compress and cleanup your work area? All it takes is planning what you want to do, drawing up a technical specification, coding a Batch job with supporting Functions that utilize the DS BASIC job control APIs, and then writing your operational procedures.

Anything is possible, you need to decide what you want to do.

Posted: Wed Mar 16, 2005 10:48 pm
by bchau
naren6876 wrote:Exactly. Thats what i want to do?.Can you help to implement that logic Ken?If possible can you give me some sample code please.
You can see sample code by just simply clicking on "Job properties". Choose the "job control" tab. Select a job on the drop down menu and then click add job. It automatically generates the code for you for that specific job. To add your own code....it all depends what you want to do. You use Basic language to code what you want to do. If you want to loop the job, you use the Basic for loop ie)
FOR I 1 to 3
[some code to do something]
NEXT I

Refer to the Ascential Datastage Basic Guide for code syntax.

Posted: Thu Mar 17, 2005 2:43 am
by vmcburney
You will find a few sample routines already in your project. Using DataStage Manager look in the Routines - SDK folder for some samples provided by Ascential. You will also find a heap of sample code on this site by searching for terms such as dsattachjob.

Posted: Thu Mar 17, 2005 4:28 am
by ray.wurlod
There is also a number of competent consultants who could create your initial few and mentor you in the process at the same time.