RowCount from the DSGetLinkInfo always return zero

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

grace
Participant
Posts: 9
Joined: Tue Aug 22, 2006 1:20 pm

RowCount from the DSGetLinkInfo always return zero

Post by grace »

I am trying to get the rowcount by using
JobRowCount = DSGetLinkInfo(JobHandle,StageName,LinkName,DSJ.LINKROWCOUNT ) in an after job subroutine , but it always returns zero while I can see from the log that there are rows being processed, I saw many people get a good result by using the DSGetLinkInfo on this forum, not sure if there is a setting issue, any help is appreciated.
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

It takes several calls to get this to work. You need a valid JobHandle by using DSAttach(). StageName has to be a valid stage name. Same with LinkName.
Mamu Kim
grace
Participant
Posts: 9
Joined: Tue Aug 22, 2006 1:20 pm

Post by grace »

Thanks a lot for your quick response!!

I am using JobHandle = DSJ.ME, so there is no need for DSAttach(), right? The stageName & LinkNames are valid.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

I think that the reason you aren't getting an output is that the "DSJ.ME" might not be valid in the after-job routine. Can you put a DSLogInfo() call into the routine and output the value of DSJ.ME? You could also do a "CALL DSLogInfo('My job name is "':DSGetJobInfo(DSJ.ME,DSJ.JOBNAME),'')"
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

The DSJ.ME constant is valid in an after-job subroutine. If you have doubt include the following three lines at the top of your code.

Code: Select all

$IFNDEF JOBCONTROL.H
$INCLUDE DSINCLUDE JOBCONTROL.H
$ENDIF
Check that the stage name and link name are correctly spelled and use correct case in the DSGetLinkInfo() call. What exact version of DataStage is this?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
grace
Participant
Posts: 9
Joined: Tue Aug 22, 2006 1:20 pm

Post by grace »

Thank you for all your response!
Yes, the DSJ.ME is valid in an afterjob routine.
But I am still not get any rowcount back, even when I tried to write the job report out to a file using the statement below:
ReportText =DSMakeJobReport(JobHandle,2,"CRLF")
I can see the job/stages/links names are in the file correctly, but the rowcount is 0, any idea?
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

I've used the routine many times in the past, it does work. But if you have a spelling or capitalization error it is unforgiving and gives you the results that you are getting. As Ray has already suggested check the Stage and the Link names. Even if the Stage is spelled correctly, does it actually link to that Link Name?
panchusrao2656
Charter Member
Charter Member
Posts: 64
Joined: Sat Sep 17, 2005 10:42 am

Post by panchusrao2656 »

I did face this issue when i use a passive stage name as stage name.Try using an active stage name.
kris007
Charter Member
Charter Member
Posts: 1102
Joined: Tue Jan 24, 2006 5:38 pm
Location: Riverside, RI

Post by kris007 »

You are supposed to use the active stage name. It is neatly documented in the help.
Kris

Where's the "Any" key?-Homer Simpson
prabu
Participant
Posts: 146
Joined: Fri Oct 22, 2004 9:12 am

Post by prabu »

grace wrote:Thank you for all your response!
Yes, the DSJ.ME is valid in an afterjob routine.
But I am still not get any rowcount back, even when I tried to write the job report out to a file using the statement below:
ReportText =DSMakeJobReport(JobHandle,2,"CRLF")
I can see the job/stages/links names are in the file correctly, but the rowcount is 0, any idea?
can you try feeding the value in the After-Job subroutine[job properties i mean] instead of your wrapper .

Code: Select all

2;C:\Tmp
grace
Participant
Posts: 9
Joined: Tue Aug 22, 2006 1:20 pm

Post by grace »

Not sure what's the difference between the passive stage name & the active stage name.
Can you explain it?
kris007
Charter Member
Charter Member
Posts: 1102
Joined: Tue Jan 24, 2006 5:38 pm
Location: Riverside, RI

Post by kris007 »

Passive Stages are stages which read/write data from/to files, database tables, datasets etc. eg: sequential files, database stages etc

Active Stages are stage which perform some kind of action(transformation) on data. eg: Transformer stage.
Kris

Where's the "Any" key?-Homer Simpson
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Can you post the code of your after-job subroutine, maybe we can find your glitch.

Code: Select all

hJob = DSJ.ME
Message = "Link row counts:"
StageList = Convert(",", @FM, DSGetJobInfo(hJob, DSJ.STAGELIST))
Loop
   Remove StageName from StageList Setting MoreStages
   LinkList = Convert(",", @FM, DSGetStageInfo(hJob, StageName, DSJ.LINKLIST))
   Loop
      Remove LinkName From LinkList Setting MoreLinks
      RowCount = DSGetLinkInfo(hJob, StageName, LinkName, DSJ.LINKROWCOUNT)
      Message<-1> = LinkName : ": " : RowCount
   While MoreLinks
   Repeat
While MoreStages
Repeat
Call DSLogInfo(Message, "MyJob")
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
grace
Participant
Posts: 9
Joined: Tue Aug 22, 2006 1:20 pm

Post by grace »

I just realized that even I can get the rowcount from the link, it won't serve the project needs.
What we are trying to do is that get the actual rowcount that being inserted/updated/deleted in the table, the count from the link is what being passed down.
So I am thinking to get the rowcount from the result of DSMakeJobReport(), but not sure why the rowcount being returned is zero too, although it has all the other info(stage,link, etc.)
Does anyone know other ways to get the rowcount being processed?

Here is my code:

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

ErrorCode = 0

*Input params
DirName = Field(InputArg,';',1)
TableName = Field(InputArg,';',2)
JobType = Field(InputArg,';',3)

JobHandle = DSJ.ME

FileName = TableName:"_":JobType:"_":"Stat.DAT"

ReportText =DSMakeJobReport(JobHandle,2,"CRLF")


Openpath DirName to t.fvar then
write ReportText to t.fvar, FileName else
call DSLogWarn("Failed to write file ":FileName:" to directory ":DirName, "DoJobReport")
end
end
else
call DSLogWarn("Failed to open directory ":DirName, "DoJobReport")
end

close t.fvar
ErrorCode = 0 ;* set this to non-zero to stop the stage/job
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

Trun on your statistics and check whether you are getting the number of rows passed per second in the green link, once the job is finished.
If not you need to turn on the Monitor.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
Post Reply