Page 1 of 1

Infinite looping of a Datastage Sequence (using waitforfile)

Posted: Wed Nov 30, 2005 2:01 pm
by RajaUsa75
My requirement is as follows:

1. The sequencer job need to wait for a file (say, salesdata.txt) to appear in a particular directory in unix box.

2. Once the processing is done, the file is deleted from the directory.

3. The job should go into loop and wait for a new file with the SAME name to appear and continue with steps 1 to 3.

This looping should always happen starting at 9AM and ending at 10PM. Job should end at 10PM and no more processing after 10PM.

I have to loop all the above steps after "the file timeout happens" or "after successfully processing the file" i.e. In both success or failure cases I have to loop again and wait for the file until 10PM.

How will I handle this situation?

Currently the job runs once without looping using filewait. Whenever a new copy is received we are forced to trigger the job again manually.

Thanks, Raj

Posted: Wed Nov 30, 2005 4:16 pm
by vmcburney
Sequence job:
- start loop with a very high number of loops defined using a job parameter in case you need to run the sequence with a limited number of loops.
- a set variables stage that calls a routine that determines how many seconds until 10PM, two outputs with a different trigger on each, jump out of the loop if seconds = 0, stay in the loop if it is > 0. 10PM should be a job parameter passed in as an argument so you can change it at run time.
- a waitforfile routine stage passing in as an argument the file name from a job parameter and the output of the secondsremaining routine. You need a routine because the waitforfile stage does not let you parametise or dynamically set the timeout.
- a job activity stage that processes the file.
- a notification stage that sends the results of the job.
- a loop end stage that takes you back to the start.
- outside the loop is a notification stage that the looping is complete that may be able to show how many times the file was processed.

Posted: Thu Dec 01, 2005 10:41 am
by RajaUsa75
Thanks vmcburney. It works!!!

Raj.