Getting count of records passed through 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

Post Reply
Bumba
Participant
Posts: 4
Joined: Sat Jun 14, 2008 9:45 am
Location: Kolkata

Getting count of records passed through a link

Post by Bumba »

I have a routine GetLinkCount() that returns right values when called from a sequence on a parallel job. But when the routine is called for a server job it returns 0.
However when the routine is tested from the manager console , it gives correct row count. But when the same routine is called from a transformer of a server job, it gives the source and target link counts of any other server job as 0.

the following is the code:

$IFNDEF JOBCONTROL.H
$INCLUDE DSINCLUDE JOBCONTROL.H
$ENDIF

handleJob = DSAttachJob(JobName, DSJ.ERRFATAL)

If NOT(handleJob) Then
Call DSLogFatal("Job Attach Failed", "JobControl")
Abort
End
Else
Ans = DSGetLinkInfo (handleJob, StageName, LinkName, DSJ.LINKROWCOUNT)
End
DetachResult = DSDetachJob(hJob)

Is this because any function used in the routine is not applicable for server jobs?
michaeld
Premium Member
Premium Member
Posts: 88
Joined: Tue Apr 04, 2006 8:42 am
Location: Toronto, Canada

Post by michaeld »

does the job you're trying to get a link countr from run as a multi instance job? if yes then you have to include the instance in the job name.

job.instance
Mike
Bumba
Participant
Posts: 4
Joined: Sat Jun 14, 2008 9:45 am
Location: Kolkata

Post by Bumba »

Its not a multi instance job. I am using the same server job and the same routine for getting link counts for different jobs (both parallel and server).
The routine when called from a transformer returns right values for parallel jobs, but for server jobs, the link count returned is 0.
However it gives right values for both server and parallel jobs when we test the routine in DS Manager.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

That function is applicable to both types of jobs. Are you giving it an active stage name, i.e. a transformer stage's link to check on in the Server job?
-craig

"You can never have too many knives" -- Logan Nine Fingers
Bumba
Participant
Posts: 4
Joined: Sat Jun 14, 2008 9:45 am
Location: Kolkata

Post by Bumba »

Yes.
The source link is between a sequential file and transformer and the target link is between a transformer and OCI stage
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

And just to be clear, in both cases the 'stage name' you pass is the transformer's name?
-craig

"You can never have too many knives" -- Logan Nine Fingers
Bumba
Participant
Posts: 4
Joined: Sat Jun 14, 2008 9:45 am
Location: Kolkata

Post by Bumba »

For the source link count , I am passing the sequential file stage name and for the taget link count, I am passing the target OCI table stage name.
In the transformer the folowing functions are used:
GetLinkCount('ServerJob_Name', 'Source_Stage_Name', 'Source_link') //for source link count
GetLinkCount('ServerJob_Name', 'Target_Stage_Name', 'target_link') //for target link count
kandyshandy
Participant
Posts: 597
Joined: Fri Apr 29, 2005 6:19 am
Location: Singapore

Post by kandyshandy »

I guess you need to pass active stage's name !! i.e. transformer stage
Kandy
_________________
Try and Try again…You will succeed atlast!!
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

YES - you need to reference an active stage, i.e. the transformer each time, and then the link either from the source or to the target.
-craig

"You can never have too many knives" -- Logan Nine Fingers
michaeld
Premium Member
Premium Member
Posts: 88
Joined: Tue Apr 04, 2006 8:42 am
Location: Toronto, Canada

Post by michaeld »

However it gives right values for both server and parallel jobs when we test the routine in DS Manager.
If the problem is that you're not passing an active stage name then it wouldn't work when running from DS manager. Or did you test other jobs in DS Manager, but not this one?
Mike
Post Reply