Page 1 of 1

Posted: Sun Oct 06, 2002 8:25 pm
by ray.wurlod
Recursion of job execution is not possible in DataStage. A particular instance of a job can only be started if it is in a runnable state, and "running" is not a runnable stage.

Iteration, on the other hand, is very straightforward. Note, though, that there is no tool in the graphical job sequencer palette for achieving it.

You have essentially two ways that you can go.

You can modify the job control code that is produced by the sequencer or a batch, or write your own, that opens the directory where the files reside (use the OpenPath statement) and loops through the file name values, starting a child job to process each file. The child job can be run using DSRunJob() after setting appropriate parameters.

Alternately you could create a job that processed the directory as if it were a table, providing a stream of file names, and invoking the sdk function UtilityRunJob().

Posted: Wed Oct 09, 2002 1:12 pm
by nigel
Hi Guys,

What about write some code that does the following:

Creates a file pointer entry in the VOC with a type "F", data location of the directory name, dictionary pointing to the same path as the dictionary of the "&UFD&" file.
This will make datastage see the direcory as a Type 1 file.
The files in the directory can then be termed as records.
You can then select all the records to a numbered select list (the key to each "record" being the filename).
Then use the READLIST command to put the keys read from the select list into a dynamic array.
Then process each key/filename with an iteration (FOR/NEXT, LOOP/REMOVE/REPEAT).

All your other methods mentioned work well, just thought I'd give another one.

Regards

Nigel Freddy

Nigel

Posted: Thu Oct 10, 2002 7:21 pm
by ray.wurlod
Nigel,
OpenPath gives you all that without having to muck about in the VOC file.
Regards,
Ray