Log to file

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

Moderators: chulett, rschirm, roy

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

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

"You can never have too many knives" -- Logan Nine Fingers
mdbatra
Premium Member
Premium Member
Posts: 175
Joined: Wed Oct 22, 2008 10:01 am
Location: City of London

Post by mdbatra »

Is there any way in BASIC to fetch the log based on the start and end time ?
Rgds,
MB
mdbatra
Premium Member
Premium Member
Posts: 175
Joined: Wed Oct 22, 2008 10:01 am
Location: City of London

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

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

"You can never have too many knives" -- Logan Nine Fingers
pandeesh
Premium Member
Premium Member
Posts: 1399
Joined: Sun Oct 24, 2010 5:15 am
Location: CHENNAI, TAMIL NADU

Post 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
pandeeswaran
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
pandeesh
Premium Member
Premium Member
Posts: 1399
Joined: Sun Oct 24, 2010 5:15 am
Location: CHENNAI, TAMIL NADU

Post by pandeesh »

Thanks Ray!After removing the quotes also, it's still going in an infinite loop.
i need to investigate .
pandeeswaran
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Add an extra exit condition from the loop, such as WHILE a > 0.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Also be more careful with your variable names, "valid" and "Valid" are two different variables.
-craig

"You can never have too many knives" -- Logan Nine Fingers
pandeesh
Premium Member
Premium Member
Posts: 1399
Joined: Sun Oct 24, 2010 5:15 am
Location: CHENNAI, TAMIL NADU

Post 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.
pandeeswaran
pandeesh
Premium Member
Premium Member
Posts: 1399
Joined: Sun Oct 24, 2010 5:15 am
Location: CHENNAI, TAMIL NADU

Post by pandeesh »

Yes craig.. There's a mismatch . I ll change that and check .
pandeeswaran
kandyshandy
Participant
Posts: 597
Joined: Fri Apr 29, 2005 6:19 am
Location: Singapore

Post by kandyshandy »

There is another way to achieve this...

Use DSGetLogEventIds... To get the details of latest run, just pass 0 as RunNumber ;)
Kandy
_________________
Try and Try again…You will succeed atlast!!
pandeesh
Premium Member
Premium Member
Posts: 1399
Joined: Sun Oct 24, 2010 5:15 am
Location: CHENNAI, TAMIL NADU

Post by pandeesh »

Sure kandy!I ll check that too! :D
pandeeswaran
pandeesh
Premium Member
Premium Member
Posts: 1399
Joined: Sun Oct 24, 2010 5:15 am
Location: CHENNAI, TAMIL NADU

Post 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
pandeeswaran
pandeesh
Premium Member
Premium Member
Posts: 1399
Joined: Sun Oct 24, 2010 5:15 am
Location: CHENNAI, TAMIL NADU

Post 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.
pandeeswaran
Post Reply