Keeping track of record counts

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

Post Reply
manavkumarm
Participant
Posts: 11
Joined: Fri Sep 05, 2003 3:45 am
Location: India

Keeping track of record counts

Post by manavkumarm »

Hi,

Does anyone have a clue how I can determine the number of records in a Data Link in a server job, and use that number for my processing in a transformer stage?

Regards,
Manav
WoMaWil
Participant
Posts: 482
Joined: Thu Mar 13, 2003 7:17 am
Location: Amsterdam

Post by WoMaWil »

Yes Manav,

there is a variable @inrownumber and a variable @outrownumber and your can count also by using the stagevariables if that doesn't fit your needs.

Better you tell what you want and we may help you more easy.

Wolfgang Huerter
=====================
Cologne, Germany
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

Manav

After a job is done then DataStage supplies routines which will tell you many rows went down each link. You can search this forum because how to call those routines has been posted.

Kim.

Kim Duke
DsWebMon - Monitor over the web
www.Duke-Consulting.com
manavkumarm
Participant
Posts: 11
Joined: Fri Sep 05, 2003 3:45 am
Location: India

Post by manavkumarm »

Thank you Kim and Wolfgang for your inputs.

The particular requirement in our project is to keep a count of the number of rows in a sequential input file that failed any of the validations performed in a transformer stage. Then, I need to reject the input file if the percentage of error records in the file exceeds a percentage supplied as a parameter to the job.

The above is why I need to know how many rows were in the input link at any point so that I can calculate the percentage of error records. Keeping track of it in a stage variable doesn't help much because I cannot pass the stage variable to the next transformer stage where my logic to reject the file resides. Likewise, accessing the row count at the very end of the job doesn't help either since I want to abort the job midway instead of wasting any more CPU cycles on the job stages that follow my error percentage check.

I can accomplish this in a round-about way by using an Aggregator stage to count the no. of rows or passing a stage variable containing the count (@inrownum as suggested by Wolfgang) into the rows of the link being passed to the next stage. But I would love it if someone could tell me an easier way.

Datastage unfortunately does not seem to support any such concept as a "Job Variable" (similar to stage variables) and the Parameters passed to a job cannot be modified by the job anywhere for such global processing. Maybe someone should suggest to them that they include them in the next version ;)
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

Put the stage variable into a derivation for a new column in your outputlink to the next transformer.

Kenneth Bland
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

"Job Variable"? You can effectively pass "variables" between transformers by taking advantage of COMMON storage. Check the online help, or look at some of the SDK routines. Don't recall the exact names off the top of my head, but the ones that do running totals or check to see if a value has changed use it.

-craig
Post Reply