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

oacvb
Participant
Posts: 128
Joined: Wed Feb 18, 2004 5:33 am

Post by oacvb »

Remove the routine from transformer stage, let the job complete. Change the routine to pass the file name as parameter and in the routine write the result (row count) in the file. Call the routine after completion of job through After-Job subroutine. Hope it will help you.
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

pravin1581 wrote: INROWNUM is not giving the total row count but incremental count.
Stick in an agregator at the end and group on a static field (if not present create one) and specify LAST for the INROWNUM column to get the last record which will be the rowcount.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
pravin1581
Premium Member
Premium Member
Posts: 497
Joined: Sun Dec 17, 2006 11:52 pm
Location: Kolkata
Contact:

Post by pravin1581 »

DSguru2B wrote:
pravin1581 wrote: INROWNUM is not giving the total row count but incremental count.
Stick in an agregator at the end and group on a static field (if not present create one) and specify LAST for the INROWNUM column to get the last record which will be the rowcount.
How can we include @INROWNUM in an aggregator stage ?
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You can not. @INROWNUM is a system variable only accessible in a Transformer stage, either upstream or downstream of your Aggregator stage.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
pravin1581
Premium Member
Premium Member
Posts: 497
Joined: Sun Dec 17, 2006 11:52 pm
Location: Kolkata
Contact:

Post by pravin1581 »

ray.wurlod wrote:You can not. @INROWNUM is a system variable only accessible in a Transformer stage, either upstream or downstream of your Aggregator stage.
So where do I need to add @INROWNUM in the job to get the row count . I have used it in the transformer and the output column corresponding to the column is giving a incremental count .
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

... and that incremental count is the row count for rows processed thus far, which is apparently what you seek. In the final row it will contain the total number of rows processed by that Transformer stage. You can run it through an Aggregator stage with its "Last" aggregate function to get a single row with the final row count.

Of course none of this is necessary. The row counts are in "active stage finishing" messages in the job log, and you can obtain them using DSGetLinkInfo() function in after-stage or after-job routines.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
pravin1581
Premium Member
Premium Member
Posts: 497
Joined: Sun Dec 17, 2006 11:52 pm
Location: Kolkata
Contact:

Post by pravin1581 »

ray.wurlod wrote:... and that incremental count is the row count for rows processed thus far, which is apparently what you seek. In the final row it will contain the total number of rows processed by that Transformer stage. You can run it through an Aggregator stage with its "Last" aggregate function to get a single row with the final row count.

Of course none of this is necessary. The row counts are in "active stage finishing" messages in the job log, and you can obtain them using DSGetLinkInfo() function in after-stage or after-job routines.
DSGetLinkInfo() function is not present in after-stage or after-job routines.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

It is if you create one. Create a routine of type before/after subroutine. In there you can invoke the DSGetLinkInfo() function (and every other function in the DataStage API). What do you want to do with this row count?
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 forums. This information has been covered time and again with several different ways. Choose the best that suits your needs.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
pravin1581
Premium Member
Premium Member
Posts: 497
Joined: Sun Dec 17, 2006 11:52 pm
Location: Kolkata
Contact:

Post by pravin1581 »

ray.wurlod wrote:It is if you create one. Create a routine of type before/after subroutine. In there you can invoke the DSGetLinkInfo() function (and every other function in the DataStage API). What do you want to do with this row count?
The following routine has been used in the transformer stage of the job.

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

The arguments passed to the Function are jobname, stagename and linkname . DSLinkInfo has been used. This cannot be defined as before/after job sub routine and when done so it takes only 2 arguments.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

:roll: How many times are we going to go 'round and 'round here? How many times have we seen this routine and trotted out very similar advice over and over? [sigh]

Of course this can be used After Job. Yes, there is only one input argument. So? Be creative - everyone passes multiple arguments there by supplying them in a delimited string. Then you simply bust up the delimited string into its component pieces first thing in the routine. Suggest you use something that you know won't be in the data supplied - a pipe would be typical.

Make sure you supply a proper status on the way out.
-craig

"You can never have too many knives" -- Logan Nine Fingers
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

:lol:
Due to popularity, we need a [sigh] icon.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

:roll:
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply