Stop the sequence on 0 rows

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
arun_im4u
Premium Member
Premium Member
Posts: 104
Joined: Mon Nov 08, 2004 8:42 am

Stop the sequence on 0 rows

Post 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.
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post 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?
lebos
Participant
Posts: 74
Joined: Mon Jan 20, 2003 10:02 am
Location: USA

Post 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
ranga1970
Participant
Posts: 141
Joined: Thu Nov 04, 2004 3:29 pm
Location: Hyderabad

Post 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.......................................
RRCHINTALA
Post Reply