job control

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
naren6876
Participant
Posts: 233
Joined: Mon Feb 07, 2005 7:19 pm

job control

Post by naren6876 »

Hi
How to write a Job Control Routine?.From any server job can we control other jobs?
pls explain

thanks,
naren
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post 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.
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
bchau
Charter Member
Charter Member
Posts: 46
Joined: Tue Jan 18, 2005 7:39 am
Location: Japan
Contact:

Post 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).
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post 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.
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
naren6876
Participant
Posts: 233
Joined: Mon Feb 07, 2005 7:19 pm

Post 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
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post 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.
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
naren6876
Participant
Posts: 233
Joined: Mon Feb 07, 2005 7:19 pm

Post 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.
bchau
Charter Member
Charter Member
Posts: 46
Joined: Tue Jan 18, 2005 7:39 am
Location: Japan
Contact:

Post 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.
vmcburney
Participant
Posts: 3593
Joined: Thu Jan 23, 2003 5:25 pm
Location: Australia, Melbourne
Contact:

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

Post 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.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply