Page 1 of 1

Routine DSJ LINKROWCOUNT Error

Posted: Fri Aug 17, 2012 3:48 pm
by somu_june
Hi,

I have a before after job subroutine to capture records in a link , but I'm always getting result as -1 .

Below is my routine

$ INCLUDE DSINCLUDE JOBCONTROL.H
RoutineName = "TestRout"
StageName = Field (InputArg,",",1)
LinkName = Field (InputArg, ",",2)
vRowcount = 0
Errorcode = 0

mainJob = DSGetJobInfo(DSJ.ME,DSJ.JOBNAME)
JobName = mainJob
IF JobName = DSJE.BADHANDLE
THEN
Call DSLogWarn("cannot attach the job", " ")
Errorcode = 0
End
vRowcount = DSGetLinkInfo (JobName,StageName,LinkName,DSJ.LINKROWCOUNT)
Call DSLogWarn("Link Rowcount":" ":vRowcount, " " )
Errorcode = 0;

From above code I'm capturing the rowcount value in a log and I'm seeing -1 always, even the link processed 5 rows in a job, I also checked I'm getting proper JobName, stagename, LinkName before calling DSGetLinkInfo and they are passed correctly and I'm calling this routine as after job subroutine with parameter value Cpy_Output,To_Cpy_outlook. I'm trying to capture record count for active stage transformer.


Any help is greatly appreciated

Thanks

Posted: Fri Aug 17, 2012 4:00 pm
by ray.wurlod
You don't exit from your routine in the event that you cannot attach the job - you blithely sail on into the DSGetLinkInfo() code.

Posted: Fri Aug 17, 2012 4:03 pm
by chulett
There's no actual attaching going on here, it is just querying the current job so not quite clear how one would get a "BADHANDLE".

Posted: Fri Aug 17, 2012 4:33 pm
by somu_june
I'm getting current job name and I need to get the proper output from DSGetLinkInfo function, even if the job handling section is wrong since the if clause will not be executed and goes directly to DSGetLinkInfo function, but it is always throwing -1 output .

I don't think it is happening due to bad jobhandle, since I can see job name . If I'm wrong correct me

Thanks

Posted: Fri Aug 17, 2012 5:49 pm
by ray.wurlod
DSGetLinkInfo() has to be called with a job handle as its first argument. You are trying to call it with a job name as the first argument. Try DSJ.ME.

Posted: Fri Aug 17, 2012 11:41 pm
by chulett
So out of all that code you just need the call to DSGetLinkInfo and the log function. Why "DSLogWarn"? Why not simply "DSLogInfo"? :?

Posted: Fri Aug 17, 2012 11:56 pm
by ArndW
Since you are using DSJ.ME as the job handle, a lot of the code is superfluous. I can't check right now, but I seem to recall that the link row count information isn't available until after the job has finished, but I'm not 100% certain - it would explain your routine's behaviour.

Posted: Sat Aug 18, 2012 7:39 am
by chulett
It is available while the job is running.

Re: Routine DSJ LINKROWCOUNT Error

Posted: Sat Aug 18, 2012 7:46 am
by ArndW
Thanks Craig - I looked at the code again:
somu_june wrote:...
vRowcount = DSGetLinkInfo (JobName,StageName,LinkName,DSJ.LINKROWCOUNT)
...
should read:

Code: Select all

vRowcount = DSGetLinkInfo(DSJ.ME,StageName,LinkName,DSJ.LINKROWCOUNT)

Posted: Sat Aug 18, 2012 7:50 am
by chulett
Yup. :wink:

Re: Routine DSJ LINKROWCOUNT Error

Posted: Sun Aug 19, 2012 4:58 pm
by Kryt0n
I would say that is all that is needed, the "attach" process is superfluous and ErrorCode only needs one assignment and job done...

Posted: Sun Aug 19, 2012 7:17 pm
by somu_june
After making the corrections as Ray mentioned it is working