Row count of a link
Moderators: chulett, rschirm, roy
Row count of a link
Hi all ,
I am getting problem to fetch row count for a given link, I have writen one routine for fetch the row count . I am using DSGetLinkInfo to fetch the row count.Strange thing happeing here is When i run the routine from DS Manager it give me the correct result , but when I am trying to call that routine in a job and using the return value , each time I am getting row count value as 0.
I am getting problem to fetch row count for a given link, I have writen one routine for fetch the row count . I am using DSGetLinkInfo to fetch the row count.Strange thing happeing here is When i run the routine from DS Manager it give me the correct result , but when I am trying to call that routine in a job and using the return value , each time I am getting row count value as 0.
Code: Select all
#Include DSINCLUDE DSD_STAGE.H
#Include DSINCLUDE JOBCONTROL.H
#Include DSINCLUDE DSD.H
#Include DSINCLUDE DSD_RTSTATUS.H
Ans = 0
ERRORCODE = 0
RejEntrWarn = "No error message"
RejEntrFatal = ""
JOBHANDLE = DSAttachJob(JobName,DSJ.ERRWARN)
ErrCode = DSWaitForJob(JOBHANDLE)
LastRunStatus = DSGetJobInfo(JOBHANDLE , DSJ.JOBSTATUS)
JobStartTime = DSGetJobInfo (JOBHANDLE, DSJ.JOBSTARTTIMESTAMP)
JobEndTime = DSGetJobInfo (JOBHANDLE, DSJ.JOBLASTTIMESTAMP)
If ((LastRunStatus = DSJS.RUNFAILED Or LastRunStatus = DSJS.STOPPED Or LastRunStatus = DSJS.CRASHED Or LastRunStatus = DSJS.RUNWARN )) Then
RejEntrWarn = DSGetLogSummary (JOBHANDLE , DSJ.LOGWARNING, JobStartTime , JobEndTime, 10)
RejEntrFatal = DSGetLogSummary (JOBHANDLE , DSJ.LOGFATAL, JobStartTime , JobEndTime, 10)
If LastRunStatus = DSJS.RUNWARN Then
JobStat = "Job completed with warnings"
End
Else
JobStat = "Job aborted due to some fatal error"
End
End
Else
JobStat = "Job completed successfully"
End
SrcRowCount = DSGetLinkInfo(JOBHANDLE ,SrcStgName,SrcLnkName,DSJ.LINKROWCOUNT)
DstRowCount = DSGetLinkInfo(JOBHANDLE ,DstStgName,DstLnkName,DSJ.LINKROWCOUNT)
Ans = JobName : "^" : JobStartTime : "^": JobEndTime : "^" : JobStat : "^" : RejEntrWarn : ";": RejEntrFatal :"^" : SrcRowCount : "^" : DstRowCount
ErrCode = DSDetachJob(JOBHANDLE)
I am calling the routine in a stage variable of a transformer, My arguments are , JobName, SourceStage Name and Source Link Name, and SImilarly Destination stage name and Destination Link Name. This basiacalyy and Audit Routine which capture the status of job after it execution. where I need source row counts and destination row count.But still I think I missing some settings, due to which I unable to get the row count when I run it thru DS Designer
So, you call this for every row through the job - over and over? And are checking the logs over and over? This kind of information is typically gathered in a separate step after the job is completed, hence the question.
You should consider calling this 'after job' if you want to keep it 'inside' the same job. And if you do you'll need to change the DSJ.JOBSTATUS to DSJ.JOBINTERIMSTATUS because if you don't, all it will ever say is 'RUNNING' from inside the job. Read about the different InfoType codes in the help.
You should consider calling this 'after job' if you want to keep it 'inside' the same job. And if you do you'll need to change the DSJ.JOBSTATUS to DSJ.JOBINTERIMSTATUS because if you don't, all it will ever say is 'RUNNING' from inside the job. Read about the different InfoType codes in the help.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
I am calling it in diffrent job ,and there is whole diffrent setup together, I think we are deviating from the Original question ,My question is I am unable to get the row count fron the routine when I call it thru DS Designer(From Job or even when I run it thru Repository browser), but the same routine give me the correct result when I run it thru DS Manger
If you are processing a list of job / stage / link names in a separate 'audit' job and calling this routine for every row, that would have been good information to know right off the bat. Would have saved a little drama.
So... if it works when you test the routine from the Manager and it doesn't work when calling it inside your job, I'd wager that you don't have the correct parameter values hooked to the right arguments. You might want to add some DSLogInfo calls to dump that information in your routine while you debug this as a double-check. Or walk through the job using the debugger. Or both.
Not sure why you do a 'DSWaitForJob' but other than that I don't see anything glaringly wrong with your routine - which is why I hadn't really commented on it up to this point. Plus I don't think you need any include files other than the job control one but I also don't believe they would hurt and/or contribute to your problem.
Is that your only problem with the routine? From your job, does all of the other information get gathered correctly but not the row counts? Perhaps an issue with passing the stage and link names in correctly in that case...
So... if it works when you test the routine from the Manager and it doesn't work when calling it inside your job, I'd wager that you don't have the correct parameter values hooked to the right arguments. You might want to add some DSLogInfo calls to dump that information in your routine while you debug this as a double-check. Or walk through the job using the debugger. Or both.
Not sure why you do a 'DSWaitForJob' but other than that I don't see anything glaringly wrong with your routine - which is why I hadn't really commented on it up to this point. Plus I don't think you need any include files other than the job control one but I also don't believe they would hurt and/or contribute to your problem.
Is that your only problem with the routine? From your job, does all of the other information get gathered correctly but not the row counts? Perhaps an issue with passing the stage and link names in correctly in that case...
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
I tried DSLogInfo and I am sure about I am passing correct Parameters,
There is one post in DSxchange itself related to my question http://dsxchange.com/viewtopic.php?t=10 ... dd44ea602f . But I am not able to find the solution from it . Please , If you can understand it and tell me the solution.
There is one post in DSxchange itself related to my question http://dsxchange.com/viewtopic.php?t=10 ... dd44ea602f . But I am not able to find the solution from it . Please , If you can understand it and tell me the solution.
Where are you looking for the output?
Are you RETURNing the "Ans"?
Try to write the Ans into a sequential file.
Even if that value found in Sequential file didn't give you expected result, for testing purpose, hard code all the parameters like job name, SrcStgName,SrcLnkName etc., and try a run.
Are you RETURNing the "Ans"?
Try to write the Ans into a sequential file.
Even if that value found in Sequential file didn't give you expected result, for testing purpose, hard code all the parameters like job name, SrcStgName,SrcLnkName etc., and try a run.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'