Looping Activity in DataStage
Moderators: chulett, rschirm, roy
Looping Activity in DataStage
Hi
I have a requirement as below
File1--->some stages---->Transformer
---->File3
---->File2
Transformer pushes data into File2 and File3
Now File3 need to become the source file File1
Again same job runs
This process should keep on going until the count in File3 becomes zero
and File2 data keeps on appending during this process
Say for example,
I have 5 records in File1 now the job starts
3 records got loaded in File3
and 2 records in File2
Now 3 records in File3 should become the source now as File1
now let us say
1 got written in File3
and 2 appended(total 4) in file2
Now 1 records in File3 should become the source now as File1
now let us say
0 got written in File3
1 got appended in File2
Now the loop should break as there are no more records for further processing in File3
I thought of using startloop and endloop activity in Sequence job but looking for any better idea.
Any suggestion is greatly appreciated
Thanks in advance
Kris
I have a requirement as below
File1--->some stages---->Transformer
---->File3
---->File2
Transformer pushes data into File2 and File3
Now File3 need to become the source file File1
Again same job runs
This process should keep on going until the count in File3 becomes zero
and File2 data keeps on appending during this process
Say for example,
I have 5 records in File1 now the job starts
3 records got loaded in File3
and 2 records in File2
Now 3 records in File3 should become the source now as File1
now let us say
1 got written in File3
and 2 appended(total 4) in file2
Now 1 records in File3 should become the source now as File1
now let us say
0 got written in File3
1 got appended in File2
Now the loop should break as there are no more records for further processing in File3
I thought of using startloop and endloop activity in Sequence job but looking for any better idea.
Any suggestion is greatly appreciated
Thanks in advance
Kris
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
-
- Premium Member
- Posts: 892
- Joined: Thu Oct 16, 2003 5:18 am
Hi
Yes you are right. I was thinking how to handle this loop end. Any suggestions from your end please
At job level, everytime I am capturing re_process file counts in a diff file
at /temp/count.txt
In Sequence level using
Execute_Cmd_Acty(read count from file)
cat /temp/count.txt
UserVariable_Activity
If Execute_Cmd_Acty.$ReturnValue > 0 Then StartLoop.$Counter Else DSJS.STOPPED
Some where I am not able to do it in right way, still loop is running
In startloop, Under loop definition
I used values
1
1
5
( I know I am doing wrong here in start loop)
Any suggestion is greatly appreciated
Thanks
Thanks
Yes you are right. I was thinking how to handle this loop end. Any suggestions from your end please
At job level, everytime I am capturing re_process file counts in a diff file
at /temp/count.txt
In Sequence level using
Execute_Cmd_Acty(read count from file)
cat /temp/count.txt
UserVariable_Activity
If Execute_Cmd_Acty.$ReturnValue > 0 Then StartLoop.$Counter Else DSJS.STOPPED
Some where I am not able to do it in right way, still loop is running
In startloop, Under loop definition
I used values
1
1
5
( I know I am doing wrong here in start loop)
Any suggestion is greatly appreciated
Thanks
Thanks
Hichulett wrote:There's no "else" to stopping. From your Execute Command stage, link a zero trigger to a stage after the End Loop. The >0 trigger goes to the End Loop stage. ...
Can you please tell me in a little more eloborative way which may help me more.
I couldnt get anything from your above sentense
Thanks a lot
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Code: Select all
---> StartLoop <--------------------- EndLoop
| ^
| |
V |
DoStuff --------> Test -----------+
| >0
| = 0
V
DoNothing
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.