Looping on a sequential file

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
Benouche
Participant
Posts: 15
Joined: Tue Apr 22, 2003 8:54 am
Location: France

Looping on a sequential file

Post by Benouche »

Hello,

I need to loop on a job by setting a parameter from a list of value stored in a sequential file. i.e. I want to launch the job one time for each line of my file.

Can I achieve this using the loop feature in the sequencer ?

Thanks,

Benouche
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Sure you can. Have an execute command stage do a cat of the file which has the list in a delimitted format (pre-massage the file if its not in that format). Connect this command stage to start loop and in the list specify #Execute_Command_Stage.$CommandOutput#.
Another way would be to build a server job that reads the sequential file and inside the transformer fire off the routine "UtilityRunJob()". This way a job will be fired the number of times a record comes in.
Another way would be to code this entire thing as a batch job.
Yet another way would be to write a small shell that does this.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
JoshGeorge
Participant
Posts: 612
Joined: Thu May 03, 2007 4:59 am
Location: Melbourne

Post by JoshGeorge »

Read the Total count of rows in seq file using Exe Cmnd
Start a loop (1 to count), read current loop number line from the seq file using UVactivity (Write a routine to read seq file) and pass it as parameter to your Job.
In case of Multi Instance this job call should be a routine which will start an instance of the job with the parameter and runs independently
Joshy George
<a href="http://www.linkedin.com/in/joshygeorge1" ><img src="http://www.linkedin.com/img/webpromo/bt ... _80x15.gif" width="80" height="15" border="0"></a>
Post Reply