Page 1 of 1

Stop the sequence on 0 rows

Posted: Tue May 24, 2005 3:04 pm
by arun_im4u
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.

Posted: Tue May 24, 2005 3:09 pm
by Sainath.Srinivasan
I assume your sequence will contain more than one job. Which row count you want to check and how you want it to work?

Posted: Tue May 24, 2005 4:05 pm
by lebos
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

Posted: Tue May 24, 2005 4:10 pm
by ranga1970
or if your input is flat file and 0 rows means no file? write routen to check file validation and call this routene in sequencer before kicking of the rest of the jobs...
if file is not present the seqencer is finishes and goes to next seuencer.......................................