Page 1 of 2

Link Count

Posted: Sat Mar 17, 2007 2:14 am
by pravin1581
FUNCTION myGetRowCount(JobName,StageName,LinkName)
$INCLUDE DSINCLUDE JOBCONTROL.H


hJob = DSAttachJob(JobName, DSJ.ERRFATAL)

RowCount = DSGetLinkInfo(hJob, StageName, LinkName, DSJ.LINKROWCOUNT)

ErrCode = DSDetachJob(hJob)

Ans = RowCount

I was looking for a working piece of routine for link row count and got the above code. I am using it in the Transformer in a very simple job to test out the code ,but the job is not getting completed , its running on and on and ultimately I had to abort the job. I am not able to figure out the solution.

Thanx in advance.

Posted: Sat Mar 17, 2007 2:29 am
by DSguru2B
Use it after the job finishes in a routine activity in a sequence job.
OR convert the routine from a transform to before/after job subroutine and call it in the after job subroutine.
You can also search the forum for other ways of getting row counts.

Posted: Sat Mar 17, 2007 2:45 am
by kumar_s
As asked, pls clarify if you are trying to attached the same job in the Transformer where it resides and trying to find row count?

Posted: Sat Mar 17, 2007 3:26 am
by pravin1581
kumar_s wrote:As asked, pls clarify if you are trying to attached the same job in the Transformer where it resides and trying to find row count?
Yes the job attached is the same job in which , I am trying to find out the row count , I am bit confused as always the routine will contain the name of the job in which the routine has been called, stage names and link names shoud differ for row counts of different link.

Posted: Sat Mar 17, 2007 8:12 am
by chulett
Please try to keep discussions of your problems in one place. Why start this post and tag the same issue onto the end of this post? :evil:

No-one enjoys trying to carry on multiple conversations on the same subject at the same time.

Posted: Sat Mar 17, 2007 1:34 pm
by ray.wurlod
... unless some scheme for multiple billing is involved. :twisted:

But here, an all-volunteer site, that is not the case.

Posted: Sat Mar 17, 2007 3:24 pm
by DSguru2B
Search the forum, there have been routines by kcbland and other folks to get a lot more information at different levels than just row counts. Kim duke leads them all with his ETLStats. Search is the key.

Posted: Tue Mar 20, 2007 7:19 pm
by kumar_s
Move it to after Job subroutine or to a different job.

Posted: Wed Mar 21, 2007 10:44 pm
by pravin1581
kumar_s wrote:Move it to after Job subroutine or to a different job.
The problem still persists . The job goes on running in which the routine of getting the link count is called in the transformer.

Posted: Wed Mar 21, 2007 11:02 pm
by chulett
The problem persists because... you haven't changed anything? Or is this now a separate job that checks another job or jobs? Describe it, this problem job - in detail - especially why it needs to call this routine in the transformer.

Posted: Thu Mar 22, 2007 12:24 am
by pravin1581
chulett wrote:The problem persists because... you haven't changed anything? Or is this now a separate job that checks another job or jobs? Describe it, this problem job - in detail - especially why it needs to call this routine in the transformer.
Basically there is a requirement of getting the number of rows coming out of aggregator stage , which precedes the transformer stage , and hence the routine is being called in the transformer. But the job is not getting finished.

Posted: Thu Mar 22, 2007 12:37 am
by chulett
What do you plan on doing with this 'number of rows coming out of the aggregator stage'? What comes after this transformer? And define 'is not getting finished'... how far does it get? Where does it seem to get stuck?

I get the impression you still don't understand the implications of what you are doing. For every record that comes out of the agg, you call this routine. Over and over. And over. I sincerely doubt that's what you really need.

Tell us your actual requirement, not your implementation. What are you trying to accomplish here? :?

Posted: Thu Mar 22, 2007 4:38 am
by pravin1581
chulett wrote:What do you plan on doing with this 'number of rows coming out of the aggregator stage'? What comes after this transformer? And define 'is not getting finished'... how far does it get? Where does it seem to get stuck?

I get the impression you still don't understand the implications of what you are doing. For every record that comes out of the agg, you call this routine. Over and over. And over. I sincerely doubt that's what you really need.

Tell us your actual requirement, not your implementation. What are you trying to accomplish here? :?
The total number of rows coming out from the output link of the aggregator stage or sorter stage is required , that values need to be populated in the file. On invoking the routine in the transformer and passing the jobname , linkname and the stage name as arguments in the job the job is running fine but it is not reaching completion. The status in the director remains " running"

Posted: Thu Mar 22, 2007 8:01 am
by Smeitei
Why don't you just use a stage variable with INROWNUM to get the count

Posted: Mon Mar 26, 2007 12:41 am
by pravin1581
Smeitei wrote:Why don't you just use a stage variable with INROWNUM to get the count
INROWNUM is not giving the total row count but incremental count.