Regarding the residense of log files in datastage.

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
SwathiVineela
Participant
Posts: 9
Joined: Mon Mar 03, 2008 1:30 am
Location: India

Regarding the residense of log files in datastage.

Post by SwathiVineela »

Hi,

Any one know where the log entries of a job when it has been run in datastage will be stored?

If we could able to find where these entries resided then, we can send mails if those entries contains warnings.
If this works more clensing part can be skipped from the datastage jobs so that when ever a mail comes that warning is there in the job then we can go back and set that warning.This makes clensing job easy.

Thanks in advance...
swathivineela
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Welcome aboard.

Yes, lots of us know. And a simple search of the forum would let you know also.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
SwathiVineela
Participant
Posts: 9
Joined: Mon Mar 03, 2008 1:30 am
Location: India

Post by SwathiVineela »

ray.wurlod wrote:Welcome aboard.

Yes, lots of us know. And a simple search of the forum would let you know also. ...
hi Ray
Thanks alot

I have searched regarding log files in the forums and i got a simple and straight forward answer for my question that

"The log records are in a database table within the Repository. The name of the table is RT_LOGnnnn, where nnnn is the job number associated with the job. You can search the forum or use LIST DICT ..."


And if my understanding is correct..

All we need to do is to get details(data) from the RT_LOG table and then insert into a flat file.

I dont have access to Administrator.
How would i get access to that RT_LOG table?
And in which schema this table exists?

Could you please help me out with this?


Thanks and Regards,
SwathiVineela
AmeyJoshi14
Participant
Posts: 334
Joined: Fri Dec 01, 2006 5:17 am
Location: Texas

Post by AmeyJoshi14 »

As per my understanding....you will not get any detail in RT_LOGxxx directory.Inorder to get the log information you have to use following functions:

1.DSFindFirstLogEntry :Retrieves entries in a log that meet the specified criteria.
2. DSFindNextLogEntry:Finds the next log entry that meets the criteria specified in DSFindFirstLogEntry.
3.DSGetLogEntry :Retrieves the specified log entry.
4.DSGetNewest LogId :Retrieves the newest entry in the log.

Datasatge uses Universe Database to store all the informations.You can search in this forum to get more details regarding the UV database. :P
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Equivalents of those same functions exist as part of 'dsjob' so you could do the same from the command line. And the 'log file' is a hashed file, not part of the 'UV database'.
-craig

"You can never have too many knives" -- Logan Nine Fingers
AmeyJoshi14
Participant
Posts: 334
Joined: Fri Dec 01, 2006 5:17 am
Location: Texas

Post by AmeyJoshi14 »

chulett wrote:Equivalents of those same functions exist as part of 'dsjob' so you could do the same from the command line. And the 'log file' is a hashed file, not part of the 'UV database'. ...
Oops! :oops: I thought that log files are the values stored in the one of the column of DS_JOBOBJECT table...sorry for that.. :shock:
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

A further search will reveal the column names in RT_LOGnnn tables. You can use a Hashed File stage or a UV stage to extract records from the log tables in a regular DataStage job and dump them to a text file by that means. There is also a Print option in the Project menu in Director that allows you to print to file - this may be easier to use.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Question - you posted in PX but stated you are using Server jobs. Which is it? The answers are different in each product.

The RT_LOGnnnn hashed file IS a table. It does not reside in a schema on an SQL database as you assume, though. The DDL is not published officially, but as Ray has already pointed out in this thread, it can be found.

I seriously doubt that get the details on the DDL of this table will solve your problems. You should use the official API or the dsjob options instead of going straight to the table.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

I disagree with Arnd. There is almost complete metadata for job logs in the file dictionary of RT_LOG. I have posted the same on DSXchange in the past. The problem is that you are blocked from importing it into the Repository (though you can work around even that).
Last edited by ray.wurlod on Wed Mar 12, 2008 5:21 pm, edited 1 time in total.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
SwathiVineela
Participant
Posts: 9
Joined: Mon Mar 03, 2008 1:30 am
Location: India

Post by SwathiVineela »

Hi all,

I have tried using a routine to bring log entries and to write into a flat file.
Following is the routine:
**** Routine Name : GetJobLog ****
**** Usage : Give the directory as the Input Value ****


$INCLUDE DSINCLUDE JOBCONTROL.H

ErrorCode = 0

Arg1=STAGE_DIR


DirName = STAGE_DIR

Suffix = ".txt"

JobName = DSGetJobInfo(DSJ.ME,DSJ.JOBNAME)
JobStarted = convert(" :-","_",DSGetJobInfo(DSJ.ME,DSJ.JOBSTARTTIMESTAMP))

FileName = JobName:"_":JobStarted:Suffix

StartTimeStamp = DSGetJobInfo (DSJ.ME, DSJ.JOBSTARTTIMESTAMP)
EndTimeStamp = DSGetJobInfo (DSJ.ME, DSJ.JOBLASTTIMESTAMP)

GetLogSum = DSGetLogSummary(DSJ.ME,DSJ.LOGANY,StartTimeStamp,EndTimeStamp,0)



OpenSeq FileName to FileVar then
write GetLogSum to FileVar,FileName else
call DSLogWarn("Failed to write file ":FileName:" to directory ":DirName, "GetJobLog")
end
end
else
call DSLogWarn("Failed to open directory ":DirName, "GetJobLog")
end

Ans=FileName
close FileVar
*************************************

but nothing was writen to the flat file .
could any one go through the code and tell what was the problem?
Please help me with this.

Thank you in advance...

Regards,
Swathi Vineela
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Please surround your program with code tags to make it legible. You are calling this as an after-job subroutine from the job itself, so I doubt that the end timestamp contians a value. Put calls to "DSLogInfo()" in your program in order to debug which path it takes and why nothing appears in your output.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

There's no WriteSeq statement that would write anything to the flat file.
If opened with OpenSeq, the statement to write a line is WriteSeq, not Write.

If you want to use Write, open the parent directory with OpenPath, rather than opening the file itself with OpenSeq.

Also, if opened with OpenSeq, you need to close with CloseSeq, not Close. This releases a lock taken by OpenSeq.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
SwathiVineela
Participant
Posts: 9
Joined: Mon Mar 03, 2008 1:30 am
Location: India

Post by SwathiVineela »

ray.wurlod wrote:There's no WriteSeq statement that would write anything to the flat file.
If opened with OpenSeq, the statement to write a line is WriteSeq, not Write.

If you want to use Write, open the parent di ...
Thank you very much for all,
with your support I was able to do that using a routine.

Thank you once again :)
swathivineela
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

In that case why not mark the thread as Resolved?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply