RowCount from the DSGetLinkInfo always return zero
Moderators: chulett, rschirm, roy
RowCount from the DSGetLinkInfo always return zero
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.
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.
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),'')"
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
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.
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?
Code: Select all
$IFNDEF JOBCONTROL.H
$INCLUDE DSINCLUDE JOBCONTROL.H
$ENDIF
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
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?
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?
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?
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
-
- Charter Member
- Posts: 64
- Joined: Sat Sep 17, 2005 10:42 am
can you try feeding the value in the After-Job subroutine[job properties i mean] instead of your wrapper .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?
Code: Select all
2;C:\Tmp
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
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.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
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
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