Page 1 of 1

How to create Automatic Job Control

Posted: Wed Jun 01, 2005 4:29 am
by i.peppermint
I would like to create one Job Control that includes all features as follows:
1. It can be applied to control every sub-jobs I created.
2. Automatic get the name of all flat files from Unix Server and pass it as a parameter to sub-job to process.


I have a number of Server jobs to populate data from flat file to Oracle tables, I call them as sub-jobs. Each sub-job reads different flat file name.
And since in each day, the number of source files are difference. Hence, I need one job control to control sub-job to run as many times as the number of source files by pass the file name as a parameter to sub-job.
Such as, there are 7 flat files with difference 7 names, that job needs to be run 7 times.

Your suggestions are very appreciated.
Thank you.

Posted: Wed Jun 01, 2005 5:06 am
by ArndW
Hello i.peppermint,

You can do this type of function from a DataStage Sequence. The basic construct for you would be the loop. You can execute a Unix shell command to get the list of files you need and loop through this list, calling your sub-job(s) and passing the filename in as a parameter to each of them in turn.

Also, the server job canvas has a folder stage, which will let you process all files {that match conditions you can specify} in a given path; this would also work from what you've described as your requirements.

BEWARE!!!

Posted: Wed Jun 01, 2005 4:40 pm
by ray.wurlod
Beware of the Folder stage. Even though you specify just file names, it seems to try to read the entire file. This can cause an abort with access violation/SIGBUS, when your memory is exhausted by trying to load a large file for no good reason.

As well as using a job sequence, you can also code it yourself by creating a server job that consists entirely of job control code. (This is exactly what a job sequence generates when compiled.) You get absolutely precise control over how your requirements are implemented, at the cost of needing to know the programming language and lower maintainability.