Page 1 of 2

capture warning message

Posted: Tue Mar 08, 2005 7:39 am
by lakshya
hi,
can anyone tell me how to capture a warning message from a job running in a sequence....without checking the log file.

Thanks

Posted: Tue Mar 08, 2005 8:17 am
by roy
Hi,
triggers will get hte knowledge of a warning or warnings being written to the log file, do you need to know the warning's message as well?

I guess a job report would give some relevantinfo.

but the real question as we many a time say: what are you trying to acomplish???
if we know that we might give a better answer.

IHTH,

Posted: Tue Mar 08, 2005 8:33 am
by lakshya
hi,
i want to know what the warning message is .....i mean like writing the warning message to a sequential file...

thanks

Posted: Tue Mar 08, 2005 8:35 am
by Sainath.Srinivasan
Read from the hash-file RT_LOGnnn where nnn is the job number.

Posted: Wed Mar 09, 2005 2:24 pm
by naren6876
HI,

HOW CAN I READ THIS RT_LOGnnn FILE?.
HOW CAN I IDENTIFY THE CORRESONDING JOBS RT_LOGnnn FILE?
THANKS,
NAREN
Sainath.Srinivasan wrote:Read from the hash-file RT_LOGnnn where nnn is the job number.

Posted: Thu Mar 10, 2005 1:03 am
by richdhan
Hi Naren,

In RT_LOGnnn, nnn is the job number. You can get the job number using the following query

SELECT JOBNO FROM DS_JOBS WHERE NAME='jobname'

You can describe the DS_JOBS hash file using LIST DICT DS_JOBS.

HTH
Rich

Posted: Thu Mar 10, 2005 4:19 am
by Sainath.Srinivasan
By-the-way, the query is to be run in Universe (uv or dssh or uvsh)

Posted: Thu Mar 10, 2005 8:02 am
by chulett
Or in the Administrator. :wink:

Posted: Thu Mar 10, 2005 9:39 am
by kduke
You could do it in a routine or job as well. Lots of routines posted. To do this in a job, you would need to parameterize the job number. You have to use a UV stage to go against the repository files. Importing the metadata is tricky as well. You need to do a q-pointer. Ray will explain.

UV stage

SELECT * FROM RT_LOG#JobNo#;

Dump it into a table or flat file. You probably want to exclude the keys that start with "/" or "\". I think only the slash records exist in the log files.

Add:

WHERE EVAL "@ID" NOT LIKE '/%'

Re: capture warning message

Posted: Thu Mar 10, 2005 9:46 am
by JeanPierreHaddad
Hello

May I offer you the routine I wrote? It even formats the message with "\n" end of line. I use this message in an email sent to the operator to keep him busy at home during the long sleepless nights of winter. ;-)

Jean-Pierre

==========================================
Parameters: JobName, EventType
==========================================
$INCLUDE DSINCLUDE JOBCONTROL.H
$INCLUDE UNIVERSE.INCLUDE ODBC.H

** Check if the job is the current one. In this case do not try to attach but use DSJ.ME

ThisJobName= DSGetJobInfo(DSJ.ME,DSJ.JOBNAME)
If ThisJobName<>JobName Then
JobHandle = DSAttachJob(JobName, DSJ.ERRFATAL)
End Else
JobHandle=DSJ.ME
End
StartDate = DSGetJobInfo (JobHandle, DSJ.JOBSTARTTIMESTAMP)

SummaryArray = DSGetLogSummary(JobHandle,EventType,StartDate,"9999-12-31", 0)
Answer=""
NLines=0
Loop
Str = Field(SummaryArray,@FM,NLines+1)
If Str<>"" Then
NLines=NLines+1
EventId=Field(Str,"\",1)
TimeStamp=Field(Str,"\",2)
EventMessage=Field(Str,"\",6)
Answer:=EventId:" ":TimeStamp:" ":EventMessage:"\n"
End
Until Str=""
Repeat

Answer=OConv(Answer,"MCP")
Loop
I= Index(Answer,"'",1)
If I>0 Then Answer=Answer[1,I-1]:Answer[I+1,Len(Answer)]
Until I=0
Repeat

Ans=Answer

Capture Warning message

Posted: Sat Mar 19, 2005 12:30 am
by rajiivnb
Hi Lakshya,

If u want to have it in a sequenctail means.. my suggestion is to give a reject file with the job itself,

say if ur target stage is a odbc stage, with name Target23. In the transformer previous to the target23, have another link for the reject file. Iin the reject file link constraint, check the reject option. and in the reject file have a column like sampleerrorfield varchar(1000) and a column from the source. in the sampleerrorfield derivation give, target23.LASTERR. S

This wil do. u will get the error message with the column from the source also. This is to get from the job itself.

Hi

Posted: Sun Mar 20, 2005 10:12 pm
by lakshya
The actual problem is....I have lot of sequences to run and each sequence inturn has multiple jobs.If a job fails , the sequence aborts....when there is a warning it just moves to run the next job in the sequence.As there are over 200 jobs in the sequences,i dont want to go to each and every log to find if there are any warnings....I wanted to find a way to capture these warning messages,if any, when these 200 jobs are run instead of checking the logs.Is there a way to capture these warnings when all the sequences are run?

Thanks and thanks for all the previous responses too.

Posted: Mon Mar 21, 2005 3:03 am
by ray.wurlod
Create additional triggers (output links) on Job Activities, triggered by the job issuing warnings or failing. Direct these links to activities that perform your recording, perhaps a routine activity invoking the routine UtilityWarningToLog, perhaps a notification activity, perhaps both.

Hi

Posted: Tue Mar 29, 2005 8:23 am
by lakshya
Hi all,
The job in a sequence has warnings only.... and the sequence finishes successfully.Can I attach a E-Mail notification activity to the end of the sequence and instead of getting all the details about all the jobs,can I only get the warning messages e-mailed .From the documentation I have read about the dssendmail_template.txt.....but I couldnt find it on my system.Can anyone tell me where i can find it and what changes should i make in the template in order to capture only the warning messages.


Thanks
Lakshya

Posted: Tue Mar 29, 2005 3:50 pm
by ray.wurlod
dssendmail_template.txt is in the project directory on the server.

You want to customise what DataStage does out of the box; you will need probably to create a job or routine to extract the warnings from the log; for example using a query constrained on severity code.

Code: Select all

SELECT "TIMESTAMP", "FULL.TEXT" FROM RT_LOGnn WHERE "TYPE" = 2 AND "TIMESTAMP" > '0';