Routine DSJ LINKROWCOUNT Error

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
somu_june
Premium Member
Premium Member
Posts: 439
Joined: Wed Sep 14, 2005 9:28 am
Location: 36p,reading road

Routine DSJ LINKROWCOUNT Error

Post 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
somaraju
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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".
-craig

"You can never have too many knives" -- Logan Nine Fingers
somu_june
Premium Member
Premium Member
Posts: 439
Joined: Wed Sep 14, 2005 9:28 am
Location: 36p,reading road

Post 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
somaraju
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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"? :?
-craig

"You can never have too many knives" -- Logan Nine Fingers
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post 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.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

It is available while the job is running.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Re: Routine DSJ LINKROWCOUNT Error

Post 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)
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Yup. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
Kryt0n
Participant
Posts: 584
Joined: Wed Jun 22, 2005 7:28 pm

Re: Routine DSJ LINKROWCOUNT Error

Post 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...
somu_june
Premium Member
Premium Member
Posts: 439
Joined: Wed Sep 14, 2005 9:28 am
Location: 36p,reading road

Post by somu_june »

After making the corrections as Ray mentioned it is working
somaraju
Post Reply