Of course there is a way and it's what I've been harping on you about from the beginning. Read the documentation I linked to which starts you off right at that function. Examine the nine different valid values for the EventType argument. You've stubbornly been sticking with DSJ_LOGANY when there are eight others to choose from, including DSJ_LOGSTARTED.pandeesh wrote:So, is there any equivalent function available in 7.x for finding recent starting event id? i don't think we can get the recent starting event via DSGetNewestLogID. Because it returns the last event of the recent run
help required in routine
Moderators: chulett, rschirm, roy
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
Craig, Now i am filtering the logs between DSJ_LOGSTARTED and DSJ_LOGANY.
Now the issue is ,once the job gets aborted the log becomes like:
Now DSJ_LOGANY fetches the last line "finished under control"
But DSJ_LOGSTARTED retrieves "Job aborted" since it's control message.
But i expect DSJ_LOGSTARTED should fetch the first line "Starting..."
Is there any way to make the job aborted message as fatal in stead of control message?
Thanks
Now the issue is ,once the job gets aborted the log becomes like:
Code: Select all
Control Starting Job........
....
....
warnings
......
fatal
.........
Control Job aborted...
[Seq...] finished under control...
But DSJ_LOGSTARTED retrieves "Job aborted" since it's control message.
But i expect DSJ_LOGSTARTED should fetch the first line "Starting..."
Is there any way to make the job aborted message as fatal in stead of control message?
Thanks
pandeeswaran
As would I. If it's not doing that, I'll have to defer that issue to your official support provider.pandeesh wrote:But i expect DSJ_LOGSTARTED should fetch the first line "Starting..."
Also, if you want to post the latest and greatest code we can make sure nothing seems amiss there.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
Code: Select all
$INCLUDE DSINCLUDE JOBCONTROL.H
JobName = Arg1
hJob = DSAttachJob(JobName, DSJ.ERRNONE)
iLatestLogID = DSGetNewestLogId(hJob, DSJ.LOGANY)
iStartID=DSGetNewestLogId(hJob, DSJ.LOGSTARTED)
For iEventID =iStartID to iLatestLogID
vEventDetail = DSGetLogEntry(hJob1, iEventID)
Ans<-1> = vEventDetail
Next iEventID
iIgnore = DSDetachJob(hJob)
I guess the final code i tried was the above one.
while mailing the dynamic array vEventDetail , i am getting only the last two lines:
Code: Select all
job aborted
[seq..] job under control finished
pandeeswaran
Update your post when you can get back on DataStage, I really don't want to discuss something you guess might be like sorta your final code.
At this stage I'd also suggest dropping 'breadcrumbs' in your code so you know what it is doing each step of the way. Check the status of each function call, when it is a -1 the call failed and you can use DSGetLastError() to find out what happened if you like. Worst case, just use DSLogInfo() to put each value into the job's log so you know both the starting id and the ending id. While you are debugging this, I'd also log the current iEventID inside the loop and each individual vEventDetail value the same way, just so you can see the progression of the code while it loops.
Comment it out once this finally works.
At this stage I'd also suggest dropping 'breadcrumbs' in your code so you know what it is doing each step of the way. Check the status of each function call, when it is a -1 the call failed and you can use DSGetLastError() to find out what happened if you like. Worst case, just use DSLogInfo() to put each value into the job's log so you know both the starting id and the ending id. While you are debugging this, I'd also log the current iEventID inside the loop and each individual vEventDetail value the same way, just so you can see the progression of the code while it loops.
Comment it out once this finally works.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
Hi Craig,
Yesterday itself i tried with a simple test.
This returns the value of 433.
While assigning iLatestLogID to Ans it returns 434.
I am curious to know how DSJ.LOGSTARTED internally works.
Does it go and find the recent id based on the keyword"Starting Job" or based on the type of log entry(in this case "Control").?
Because both the log entries "Starting Job" and "Job aborted" belong to Control sort of log entries.
Since DSGetNewestLogEntry fetches most recent entry, it's fetching "Job aborted"
Correct me if my assumption is incorrect.
Thanks.
Yesterday itself i tried with a simple test.
Code: Select all
$INCLUDE DSINCLUDE JOBCONTROL.H
JobName = Arg1
hJob = DSAttachJob(JobName, DSJ.ERRNONE)
iLatestLogID = DSGetNewestLogId(hJob, DSJ.LOGANY)
iStartID=DSGetNewestLogId(hJob, DSJ.LOGSTARTED)
Ans=iStartID
iIgnore = DSDetachJob(hJob)
While assigning iLatestLogID to Ans it returns 434.
I am curious to know how DSJ.LOGSTARTED internally works.
Does it go and find the recent id based on the keyword"Starting Job" or based on the type of log entry(in this case "Control").?
Because both the log entries "Starting Job" and "Job aborted" belong to Control sort of log entries.
Since DSGetNewestLogEntry fetches most recent entry, it's fetching "Job aborted"
Correct me if my assumption is incorrect.
Thanks.
pandeeswaran
i have connected to datastage and the code is:
in the mail i have recieved the below entries:
From this , it's clear that DSJ.LOGSTARTED is not fetching as per our expectation.
The next test confirms that:
i have chosen one "finished " job.
i have passed that job name as the argument for the below code:
As usual, the result is not "Starting job".
It gives the last control entry:
The behaviour of DSJ.LOGSTARTED is puzzling.
is this the bug in 7.5.1 or am i doing incorrectly?
Please share your thoughts
Code: Select all
$INCLUDE DSINCLUDE JOBCONTROL.H
JobName = Arg1
hJob = DSAttachJob(JobName, DSJ.ERRNONE)
NewestStartId = DSGetNewestLogId(hJob, DSJ.LOGSTARTED)
NewestLogId = DSGetNewestLogId(hJob, DSJ.LOGANY)
For iEventID = NewestStartId to NewestLogId Step+1
vEventDetail<-1> = iEventID:DSGetLogEntry(hJob, iEventID)
next iEventID
Mail = DSSendMail("From:DataStage@bcd.com\nTo:avc@xd.com\nServer:b01\nSubject:\nBody:Please find the log":vEventDetail )
Ans = Mail
iIgnore = DSDetachJob(hJob)
Code: Select all
774 2011-07-09 13:17:36\eadm\5\Job Report has been reset.
775 2011-07-09 13:17:36\eadm\7\(SeqReport) <- Report: Job under control finished.
The next test confirms that:
i have chosen one "finished " job.
i have passed that job name as the argument for the below code:
Code: Select all
$INCLUDE DSINCLUDE JOBCONTROL.H
JobName = Arg1
hJob = DSAttachJob(JobName, DSJ.ERRNONE)
NewestStartId = DSGetNewestLogId(hJob, DSJ.LOGSTARTED)
NewestLogId = DSGetNewestLogId(hJob, DSJ.LOGANY)
vEventDetail<-1> = NewestStartId :DSGetLogEntry(hJob, NewestStartId)
Ans= vEventDetail
It gives the last control entry:
Code: Select all
292011-07-08 07:21:01\eadm\5\Finished Job agg.
is this the bug in 7.5.1 or am i doing incorrectly?
Please share your thoughts
pandeeswaran
Nothing is jumping out at me as incorrect, so again I'd suggest putting all this information in front of your official support provider.pandeesh wrote:The behaviour of DSJ.LOGSTARTED is puzzling.
is this the bug in 7.5.1 or am i doing incorrectly?
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
Pandeesh,
Did you manage to solve this issue?
The same thing is happening to me and the routing can't properly locate the latest starting event for the job. This happens when I use the the syntax, you are using i.e.
However, when I changed the routine to do the following instead:
the routine is able to locate the starting event correctly.
Unfortunately, it has to be run from within the job and makes it impossible to test "dry".
Maybe it will help you. Unfortunately, it does not solve my issues entirely, as I need to extract the name of another job from the log event, and then attach to that job, so I need to use the job handle method.
Did you manage to solve this issue?
The same thing is happening to me and the routing can't properly locate the latest starting event for the job. This happens when I use the the syntax, you are using i.e.
Code: Select all
hJob = DSAttachJob(JobName, DSJ.ERRNONE)
NewestStartId = DSGetNewestLogId(hJob, DSJ.LOGSTARTED)
NewestLogId = DSGetNewestLogId(hJob, DSJ.LOGANY)
Code: Select all
NewestStartId = DSGetNewestLogId(DSJ.ME, DSJ.LOGSTARTED)
NewestLogId = DSGetNewestLogId(DSJ.ME, DSJ.LOGANY)
Unfortunately, it has to be run from within the job and makes it impossible to test "dry".
Maybe it will help you. Unfortunately, it does not solve my issues entirely, as I need to extract the name of another job from the log event, and then attach to that job, so I need to use the job handle method.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact: