Extract of log file using DSGetLogEntry not working

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

Moderators: chulett, rschirm, roy

DSRajesh
Premium Member
Premium Member
Posts: 297
Joined: Mon Feb 05, 2007 10:37 pm

Post by DSRajesh »

Chulett,

Could you please post the dsloginfo information?
RD
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

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

"You can never have too many knives" -- Logan Nine Fingers
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

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

"You can never have too many knives" -- Logan Nine Fingers
DSRajesh
Premium Member
Premium Member
Posts: 297
Joined: Mon Feb 05, 2007 10:37 pm

Post 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
RD
DSRajesh
Premium Member
Premium Member
Posts: 297
Joined: Mon Feb 05, 2007 10:37 pm

Post by DSRajesh »

any one please respond on this
RD
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

I would (again) but you're basically ignoring everything I'm suggesting, so what's the point?
-craig

"You can never have too many knives" -- Logan Nine Fingers
DSRajesh
Premium Member
Premium Member
Posts: 297
Joined: Mon Feb 05, 2007 10:37 pm

Post 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
RD
DSRajesh
Premium Member
Premium Member
Posts: 297
Joined: Mon Feb 05, 2007 10:37 pm

Post 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.
RD
MarkB
Premium Member
Premium Member
Posts: 95
Joined: Fri Oct 27, 2006 9:13 am

Post 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.
DSRajesh
Premium Member
Premium Member
Posts: 297
Joined: Mon Feb 05, 2007 10:37 pm

Post 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.
RD
MarkB
Premium Member
Premium Member
Posts: 95
Joined: Fri Oct 27, 2006 9:13 am

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

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

"You can never have too many knives" -- Logan Nine Fingers
MarkB
Premium Member
Premium Member
Posts: 95
Joined: Fri Oct 27, 2006 9:13 am

Post by MarkB »

Thanks Craig.

Wow, four years??? It's great that you still come here and help out so much.
DSRajesh
Premium Member
Premium Member
Posts: 297
Joined: Mon Feb 05, 2007 10:37 pm

Post by DSRajesh »

Craigee,

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

Kudos



:)
RD
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Moved over to the Dark Side... doing Informatica for the DoD now. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply