Infinite looping of a Datastage Sequence (using waitforfile)

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
RajaUsa75
Participant
Posts: 7
Joined: Sun Feb 20, 2005 1:55 pm

Infinite looping of a Datastage Sequence (using waitforfile)

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

Post 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.
RajaUsa75
Participant
Posts: 7
Joined: Sun Feb 20, 2005 1:55 pm

Post by RajaUsa75 »

Thanks vmcburney. It works!!!

Raj.
Post Reply