Page 1 of 1

Getting count of records passed through a link

Posted: Tue Dec 16, 2008 10:04 am
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?

Posted: Tue Dec 16, 2008 10:50 am
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

Posted: Tue Dec 16, 2008 10:59 am
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.

Posted: Tue Dec 16, 2008 11:06 am
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?

Posted: Tue Dec 16, 2008 1:00 pm
by Bumba
Yes.
The source link is between a sequential file and transformer and the target link is between a transformer and OCI stage

Posted: Tue Dec 16, 2008 1:05 pm
by chulett
And just to be clear, in both cases the 'stage name' you pass is the transformer's name?

Posted: Tue Dec 16, 2008 1:17 pm
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

Posted: Tue Dec 16, 2008 1:20 pm
by kandyshandy
I guess you need to pass active stage's name !! i.e. transformer stage

Posted: Tue Dec 16, 2008 3:13 pm
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.

Posted: Tue Dec 16, 2008 6:19 pm
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?