Page 2 of 3

Posted: Wed Feb 15, 2012 8:42 am
by chulett
The only way to know would be to open a support case. If you are seeing this behaviour across multiple jobs (rather than just a specific one) then that would be the next step that I would suggest.

Posted: Wed Feb 15, 2012 12:50 pm
by mdbatra
Is there any way in BASIC to fetch the log based on the start and end time ?

Posted: Wed Feb 15, 2012 1:05 pm
by mdbatra
As i was building the functionality only for the adhoc failure requests, what i have designed is to provide the Latest start event id as a parameter(but manually, from the job log) :)

So, for time being i have this workaround. would work out in detail later and share the updates.

Thanks all for your kind suggestions.

Posted: Wed Feb 15, 2012 2:07 pm
by chulett
mdbatra wrote:Is there any way in BASIC to fetch the log based on the start and end time ?
From what I recall the answer is yes, but I don't have my documention handy to check at this moment.

Posted: Wed Feb 15, 2012 2:14 pm
by pandeesh
i have tried to get the correct start event id..but it's going in an infinite loop.

Code: Select all

$INCLUDE DSINCLUDE JOBCONTROL.H
hj=DSAttachJob(Jobname,DSJ.ERRFATAL)
START_ID=DSGetNewestLogId(hj,DSJ.LOGRESET)
END_ID=DSGetNewestLogId(hj,DSJ.LOGANY)
Valid=1
a=START_ID-1
LOOP
WHILE valid<>0 DO
   Detail=DSGetLogEntry(hj,a)
   EventType=Field(Detail,"\",3,1)
   if EventType = "DSJ.LOGSTARTED"
   then
      begin=a
      valid=0
   End
   else
      valid=1
      a-=1
   END
REPEAT
Ans=begin:" " :END_ID

Posted: Wed Feb 15, 2012 3:10 pm
by ray.wurlod
Remove the quotes from around DSJ.LOGSTARTED. This is a predefined integer constant. By making it a string constant you will never succeed in matching the value. Therefore you have an infinite loop.

Posted: Wed Feb 15, 2012 11:09 pm
by pandeesh
Thanks Ray!After removing the quotes also, it's still going in an infinite loop.
i need to investigate .

Posted: Thu Feb 16, 2012 12:19 am
by ray.wurlod
Add an extra exit condition from the loop, such as WHILE a > 0.

Posted: Thu Feb 16, 2012 12:31 am
by chulett
Also be more careful with your variable names, "valid" and "Valid" are two different variables.

Posted: Thu Feb 16, 2012 12:36 am
by pandeesh
Thanks Ray.. I ll check it shortly since I am in a travel.
But what I believe is the loop will exit once it finds the proper start event .
Because valid=0 once it finds the start event .
The loop will work only when valid<>0.
Correct me if I am wrong .
Thanks.

Posted: Thu Feb 16, 2012 12:50 am
by pandeesh
Yes craig.. There's a mismatch . I ll change that and check .

Posted: Thu Feb 16, 2012 1:40 am
by kandyshandy
There is another way to achieve this...

Use DSGetLogEventIds... To get the details of latest run, just pass 0 as RunNumber ;)

Posted: Thu Feb 16, 2012 2:02 am
by pandeesh
Sure kandy!I ll check that too! :D

Posted: Thu Feb 16, 2012 2:04 am
by pandeesh
Modrators,

Don't feel that i am hijacking the thread. I am trying to provide the proper solution for badra(the same issue i have faced earlier).

Thanks

Posted: Thu Feb 16, 2012 5:55 am
by pandeesh
Success!! It works fine now..

Code: Select all

$INCLUDE DSINCLUDE JOBCONTROL.H

hj=DSAttachJob(Jobname,DSJ.ERRFATAL)

START_ID=DSGetNewestLogId(hj,DSJ.LOGSTARTED)
END_ID=DSGetNewestLogId(hj,DSJ.LOGANY)

valid=1
a=START_ID-1

LOOP
WHILE valid<>0 DO
Detail=DSGetLogEntry(hj,a)
EventType=Field(Detail,"\",4,1)[1,5]
if EventType="Start"
then
begin=a
valid=0
End
else
valid=1
a-=1
END
REPEAT
Ans=begin:" " :END_ID
@Badra,

The above will give you the start and end id, so that you cna loop through.