Routine
Posted: Fri Aug 15, 2008 1:15 pm
Hi,
I have an after-job routine that captures the row count stats in a job based on the link names (SRC, TGT & REJ). The routine works for most cases, but for some types of jobs (Jobs that have a seq file as a target) the row counts are doubled. I tried my best not to calculate row counts for links that have already been calculated but it doesnt seem to work. I have pasted my code below. If someone can point out what is wrong or any new ideas it would be great.
I have an after-job routine that captures the row count stats in a job based on the link names (SRC, TGT & REJ). The routine works for most cases, but for some types of jobs (Jobs that have a seq file as a target) the row counts are doubled. I tried my best not to calculate row counts for links that have already been calculated but it doesnt seem to work. I have pasted my code below. If someone can point out what is wrong or any new ideas it would be great.
Code: Select all
$INCLUDE DSINCLUDE JOBCONTROL.H
Equate pJobName to "EtlAfterJob"
JobHandle = ''
Stage = ''
JobName = DSGetJobInfo(DSJ.ME,DSJ.JOBNAME)
AfterJob = ''
AfterJob = "EtlAfterJob" :'.':Arg1:'_': JobName
JobHandle = DSAttachJob(AfterJob, DSJ.ERRNONE)
StageList = DSGetJobInfo(DSJ.ME, DSJ.STAGELIST)
StageCount = DCount(StageList, ",")
Src = 0
Total = 0
Rej = 0
For Count = 1 to StageCount
StageName = Field(StageList, ",", Count)
LinkList = DSGetStageInfo(DSJ.ME, StageName, DSJ.LINKLIST)
LinkCount = DCount(LinkList, ",")
For LCount = 1 to LinkCount
LinkName = Field(LinkList, ",", LCount)
LinkRowCount = DSGetLinkInfo(DSJ.ME, StageName, LinkName , DSJ.LINKROWCOUNT)
If (Index(LinkName, Stage, 1)=0 and Index(LinkName, 'TGT',1)<>0)
then Total = Total + LinkRowCount
Else if (Index(LinkName, Stage, 1)=0 and Index(LinkName, 'SRC',1)<>0)
then Src = Src + LinkRowCount
Else if (Index(LinkName, Stage, 1)=0 and Index(LinkName, 'REJ',1)<>0) then Rej = Rej + LinkRowCount else 0
Stage = Stage :'-': LinkName
Next LCount
Next Count
ErrCode1 = DSSetParam(JobHandle, "SrcRowCount", Src)
ErrCode1 = DSSetParam(JobHandle, "OutRowCount", Total)
ErrCode1 = DSSetParam(JobHandle, "RejRowCount", Rej)
ErrCode1 = DSRunJob(JobHandle, DSJ.RUNNORMAL)
ErrorCode = 0 ; * set this to non-zero to stop the stage/job