Row count of a link

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

shrinivas
Participant
Posts: 53
Joined: Mon Sep 18, 2006 3:42 am
Location: hyd

Row count of a link

Post by shrinivas »

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.
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

Have you tried searching.
Start with this. And get back if you still find it difficult to trace out.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
shrinivas
Participant
Posts: 53
Joined: Mon Sep 18, 2006 3:42 am
Location: hyd

Post by shrinivas »

Sorry Kumar ,I am still unable to trace the solutuion, I am unable to find the monitor tab in the DS administrator. Possile reason is as I am using Server edition. I have never worked on PX, so dont have any Idea about it , Will be great full to you if you can explain me the solution.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

The 'Monitor tab' is in the Director.

Can you post the routine you wrote? Please wrap it in 'code' tags so that your formatting is preserved. Also inlcude an example of how and especially where you are calling it in your job. Thanks.
-craig

"You can never have too many knives" -- Logan Nine Fingers
shrinivas
Participant
Posts: 53
Joined: Mon Sep 18, 2006 3:42 am
Location: hyd

Post by shrinivas »

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 this routine in a job and passing the Job name, Stage name and respective link name from the job itself. My problem is , even I run the routine from the repository view of Designer , I am getting the row count as 0, but if I brouse it thru Manager and execute it I am getting the correct row count.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Where are you calling this? This is gathering more than just a link row count. Also, please verify what your arguments are.
-craig

"You can never have too many knives" -- Logan Nine Fingers
shrinivas
Participant
Posts: 53
Joined: Mon Sep 18, 2006 3:42 am
Location: hyd

Post by shrinivas »

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
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

:? 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.
-craig

"You can never have too many knives" -- Logan Nine Fingers
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

Better call it in separate job or routine.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
shrinivas
Participant
Posts: 53
Joined: Mon Sep 18, 2006 3:42 am
Location: hyd

Post by shrinivas »

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
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

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. :wink:

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
shrinivas
Participant
Posts: 53
Joined: Mon Sep 18, 2006 3:42 am
Location: hyd

Post by shrinivas »

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.
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

Does the statistics (row/sec) appear on the link when show performance static is enabled? Will it change to green and show up some value when it finishes OK.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
shrinivas
Participant
Posts: 53
Joined: Mon Sep 18, 2006 3:42 am
Location: hyd

Post by shrinivas »

Ya , Statistics turn to green and shows the number of rows/sec processed. Even I can see the number of rows processed in the DS Director -> Monitor when I right click on the job and select Monitor.
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

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.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
Post Reply