Forcing a DataStage job to Abort based on a rule

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
catmans1
Charter Member
Charter Member
Posts: 3
Joined: Tue Nov 05, 2002 7:27 am
Location: Oshawa, ON

Forcing a DataStage job to Abort based on a rule

Post by catmans1 »

Does anyone know if there is a way to force a DataStage job to abort when a certain condition doesn't match?

I have the need to do balance and controls within DataStage 5.2 on HP-UXIX. I read a file that has the first record containing total count (of all records) and I'm to match it to the count of all records in the file. Once I have the total count of the records after processing then through a transformer I need to see if they match, if so continue processing otherwise abort the job and do not load the records to the Target table.

Has anyone done anything like this?

Any help would be great.

Thank you,

Clarence
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Row count reconciliation is a fairly common requirement. If you really want your job to abort, perform the check in an after-stage subroutine and set its ErrorCode argument to a non-zero value.
The number of rows to be processed can be obtained in a before-stage subroutine and loaded into a variable defined as being COMMON.
The number of rows processed can be obtained by requesting the LinkRowCount property of the stage's input link:
RowCount = DSGetLinkInfo(DSJ.ME,DSJ.ME,LinkName,DSJ.LINKROWCOUNT)
This value can be compared with the value in the variable defined as being COMMON that was initialized in the before-stage subroutine.
Ta da!

However, I counsel strongly against aborting jobs. I prefer to retain control in my own structures. So, instead of aborting the job (which is what setting ErrorCode to a non-zero value does), I would set a flag somewhere and have it detected in an after-job subroutine or in a controlling job.
Post Reply