Page 2 of 3

Posted: Wed Nov 20, 2013 2:27 pm
by DSRajesh
Chulett,

Could you please post the dsloginfo information?

Posted: Wed Nov 20, 2013 2:47 pm
by chulett
There's nothing more for me to post. Right now I'm suggesting that as a debugging aid you add calls to DSLogInfo() to your routine to see the data you are working with. Write the LogList value to the log after you fetch it. Write vEventDetail to the log after you fetch it. Etc.

They'll help you figure out where things are going wrong with your 'for loop'... something I've already mentioned.

Posted: Wed Nov 20, 2013 11:43 pm
by chulett
Another thing - you have a list of event ids. You can't simply use that in the for loop as the from and to values... it's a list after all. Count how many entries are in the list and then loop from 1 to Count and use the loop counter to pull the Nth event id from the list and then get the log entry for it... until you run off the end of the list.

Posted: Thu Nov 21, 2013 12:25 am
by DSRajesh
Craig,

I have modified the routine as below.

$INCLUDE DSINCLUDE JOBCONTROL.H
JobName = Arg1


hJob = DSAttachJob(JobName, DSJ.ERRNONE)



LogIdList = DSGetLogEventIds(hJob1, 0, 'S')

Start_EventID=Field(LogIdList,'\',1)
End_EventID=Field(LogIdList,'\',2,999)

For iEventID = Start_EventID to End_EventID Step 1

vEventDetail<-1> = DSGetLogEntry(hJob, iEventID)

next iEventID


Ans = vEventDetail

*iIgnore = DSDetachJob(hJob)


while testing it i am getting only the last event log entry which is with End_EventID.

Please suggest what needs to be changed here to get all the log entries

Posted: Thu Nov 21, 2013 8:49 am
by DSRajesh
any one please respond on this

Posted: Thu Nov 21, 2013 9:15 am
by chulett
I would (again) but you're basically ignoring everything I'm suggesting, so what's the point?

Posted: Thu Nov 21, 2013 9:20 am
by DSRajesh
I am able to fetch first 10 log entries with the specified code but not able fetch the remanining entries.Is there are any issue with array or so

Posted: Thu Nov 21, 2013 10:51 pm
by DSRajesh
Ray,

Could you please tell me why unable to fetch the log entry after 10th entry

$INCLUDE DSINCLUDE JOBCONTROL.H
JobName = Arg1


hJob = DSAttachJob(JobName, DSJ.ERRNONE)



LogIdList = DSGetLogEventIds(hJob1, 0, 'S')

Start_EventID=Field(LogIdList,'\',1)
End_EventID=Field(LogIdList,'\',2,999)

For iEventID = Start_EventID to End_EventID Step 1

vEventDetail = vEventDetail:DSGetLogEntry(hJob, iEventID)

next iEventID


Ans = vEventDetail

*iIgnore = DSDetachJob(hJob)


Please suggest me on this code.

Posted: Fri Nov 22, 2013 6:48 am
by MarkB
The problem is - you're not listening to what you are being told.

First off, when you call DSGetLogEventIds with the 'S' option, you are filtering your results out to just Start and End events, so you are not going to return other log events.

Your code uses hJob for the job handle but you use hJob1 in the call to DSGetLogEventIds, so unless a typo on your part don't know what you expect to get returned in your results.

Here's a quick and dirty routine you can look at:

Code: Select all

$INCLUDE DSINCLUDE JOBCONTROL.H 
JobName = Arg1 
vEventDetail = ""
hJob = DSAttachJob(JobName, DSJ.ERRNONE) 
LogIdList = DSGetLogEventIds(hJob, 0,'') 
Convert "\" to @AM In LogIdList
LCnt = Dcount(LogIdList,@AM)
For x = 1 to LCnt
     LId = LogIdList<x>
     vEventDetail<-1> = DSGetLogEntry(hJob,LId) 
Next
Ans = vEventDetail
See if that helps.

Posted: Fri Nov 22, 2013 7:28 am
by DSRajesh
Hi Mark

Thanks for your reply.

still i am unable to get the complete log entries..

Working on that and will post back once resolved.

Posted: Fri Nov 22, 2013 8:28 am
by MarkB
Actually, it was a quick down-and-dirty routine. Really should have set:
vEventDetail = "" in the beginning. :oops:

But, I've run it for a few jobs and I get all entries from the previous run returned. What exactly are you missing?

Posted: Fri Nov 22, 2013 9:10 am
by chulett
Added that to your example code, Mark. Thanks for the assist, in my fourth year of living DataStage-less so no ability to test a darn thing.

Posted: Fri Nov 22, 2013 10:05 am
by MarkB
Thanks Craig.

Wow, four years??? It's great that you still come here and help out so much.

Posted: Fri Nov 22, 2013 2:52 pm
by DSRajesh
Craigee,

Congrats for your 4th year celebrations...keep it up....

Kudos



:)

Posted: Fri Nov 22, 2013 2:54 pm
by chulett
Moved over to the Dark Side... doing Informatica for the DoD now. :wink: