Hi all,
I have a master sequence job which calls many sequences within it. Each one of the sequence job updates 4 tables in the database. My problem is how to stop my sequence if i get 0 rows and trigger the next sequence. If i get 0 rows then it should not update any tables and go to the next sequence.
Any suggestions would be helpful.
Thanks,
Arun.
Stop the sequence on 0 rows
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 3337
- Joined: Mon Jan 17, 2005 4:49 am
- Location: United Kingdom
Arun,
I would suggest writing a routine which would set the user status based on the input row count. This status would be passed up to the calling job activity which would check it in a trigger.
The (before/after) routine would be something like this:
$INCLUDE DSINCLUDE JOBCONTROL.H
Ans = InputArg
Stage = field(Ans,",",1)
Link = field(Ans,",",2)
Ans = DSGetLinkInfo(DSJ.ME,Stage,Link, DSJ.LINKROWCOUNT)
Call DSSetUserStatus(Ans)
ErrorCode = 0 ;* set this to non-zero to stop the stage/job
This will set the user status to the number of rows in the applicable link. I would be called as an after stage subroutine in a transform passing in the stage name and the link name.
There are probably other, better methods, but I have used this and it works.
Larry
I would suggest writing a routine which would set the user status based on the input row count. This status would be passed up to the calling job activity which would check it in a trigger.
The (before/after) routine would be something like this:
$INCLUDE DSINCLUDE JOBCONTROL.H
Ans = InputArg
Stage = field(Ans,",",1)
Link = field(Ans,",",2)
Ans = DSGetLinkInfo(DSJ.ME,Stage,Link, DSJ.LINKROWCOUNT)
Call DSSetUserStatus(Ans)
ErrorCode = 0 ;* set this to non-zero to stop the stage/job
This will set the user status to the number of rows in the applicable link. I would be called as an after stage subroutine in a transform passing in the stage name and the link name.
There are probably other, better methods, but I have used this and it works.
Larry