Link Count

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

pravin1581
Premium Member
Premium Member
Posts: 497
Joined: Sun Dec 17, 2006 11:52 pm
Location: Kolkata
Contact:

Link Count

Post 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.
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post 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.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post 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?
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
pravin1581
Premium Member
Premium Member
Posts: 497
Joined: Sun Dec 17, 2006 11:52 pm
Location: Kolkata
Contact:

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

Post 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.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

... unless some scheme for multiple billing is involved. :twisted:

But here, an all-volunteer site, that is not the case.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post 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.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

Move it to after Job subroutine or to a different job.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
pravin1581
Premium Member
Premium Member
Posts: 497
Joined: Sun Dec 17, 2006 11:52 pm
Location: Kolkata
Contact:

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

Post 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.
-craig

"You can never have too many knives" -- Logan Nine Fingers
pravin1581
Premium Member
Premium Member
Posts: 497
Joined: Sun Dec 17, 2006 11:52 pm
Location: Kolkata
Contact:

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

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

"You can never have too many knives" -- Logan Nine Fingers
pravin1581
Premium Member
Premium Member
Posts: 497
Joined: Sun Dec 17, 2006 11:52 pm
Location: Kolkata
Contact:

Post 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"
Smeitei
Participant
Posts: 28
Joined: Tue Jan 23, 2007 3:14 pm

Post by Smeitei »

Why don't you just use a stage variable with INROWNUM to get the count
pravin1581
Premium Member
Premium Member
Posts: 497
Joined: Sun Dec 17, 2006 11:52 pm
Location: Kolkata
Contact:

Post 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.
Post Reply