How to get full length warning messages in attachment

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
sateeshbabu
Participant
Posts: 48
Joined: Sat Oct 22, 2005 9:56 am

How to get full length warning messages in attachment

Post by sateeshbabu »

Hi all,

We wrote a routine to retrieve the log to a file and in our sequence job we used mailnotification to get alerts incase of job failure or warnings.We would be able to get the logs as an attachment to the mail properly but when we look at the attachment we are not able to see the full length warning message in the Log file, it is showing like this

"Lc_Tfm_Mfs_Process.Trn_Mfs_Exp_Rate_Maint: At row 1, link "txn_mfs_exp_rate_maintenance" (...)"

When we double click on warning in director it shows full warning like this

"Lc_Tfm_Mfs_Process.Trn_Mfs_Exp_Rate_Maint: At row 1, link "txn_mfs_exp_rate_maintenance" Inserted value too large for column, row rejected."

Could you please suggect us how to get the full length warning message as stated above.
Plot No – B4, Jeevan Akshyay apts
8/14, 2nd Main Road, Jaya Nagar
Tambaram sanitorium,
Chennai-47.
smandepudi@gmail.com
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

It seems that the truncation occurred in your program that gets the log entries into a file. How did you do that? Once that is known a solution might become apparent.
sateeshbabu
Participant
Posts: 48
Joined: Sat Oct 22, 2005 9:56 am

Post by sateeshbabu »

Hi,

Here is the routine we used

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)
BusinessDay = Date()
*CurrentTime= Oconv (Time(), "MTS")
CurrentTime= Int( Time() )
CurrentDateTime= Oconv (BusinessDay, "DY[4]") : Oconv (BusinessDay, "DM[2]"): Oconv (BusinessDay, "DD[2]") :"_": CurrentTime ;
Tommorow = Oconv(Date()+1, "D-YMD[4,2,2]")
EventType = ''
Answer = ''
LogMessage = ''

SummaryArray = DSGetLogSummary(JobHandle,EventType,StartDate,"9999-12-31", 0)

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)
LogMessage:=TimeStamp:" ":EventMessage: char(10)
End
Until Str=""
Repeat
** FileName = CurrentDateTime:"_": JobName : ".txt"
FileName = JobName : ".txt"

Openpath PathName to t.fvar then
write LogMessage to t.fvar, FileName
else
call DSLogWarn("Failed to write file ":FileName:" to directory ":PathName, "RetrieveLogToFile")
GoTo ExitFunction ;
end
end
else
call DSLogWarn("Failed to open directory ":PathName, "RetrieveLogToFile")
GoTo ExitFunction ;
end

Call DSLogInfo ("Created Log File ": PathName : "/" : FileName:" status=":Status(), "RetrieveLogToFile")
Answer=LogMessage
GoTo EndFunction ;

ExitFunction:
Answer=LogMessage
GoTo EndFunction ;

EndFunction:
ErrCode = DSDetachJob(JobHandle)
Ans=Answer



Even when we test the routine it gives the truncate warning message in display.
Any suggestions please.
Plot No – B4, Jeevan Akshyay apts
8/14, 2nd Main Road, Jaya Nagar
Tambaram sanitorium,
Chennai-47.
smandepudi@gmail.com
sateeshbabu
Participant
Posts: 48
Joined: Sat Oct 22, 2005 9:56 am

Post by sateeshbabu »

Hi,

Here is the routine we used

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)
BusinessDay = Date()
*CurrentTime= Oconv (Time(), "MTS")
CurrentTime= Int( Time() )
CurrentDateTime= Oconv (BusinessDay, "DY[4]") : Oconv (BusinessDay, "DM[2]"): Oconv (BusinessDay, "DD[2]") :"_": CurrentTime ;
Tommorow = Oconv(Date()+1, "D-YMD[4,2,2]")
EventType = ''
Answer = ''
LogMessage = ''

SummaryArray = DSGetLogSummary(JobHandle,EventType,StartDate,"9999-12-31", 0)

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)
LogMessage:=TimeStamp:" ":EventMessage: char(10)
End
Until Str=""
Repeat
** FileName = CurrentDateTime:"_": JobName : ".txt"
FileName = JobName : ".txt"

Openpath PathName to t.fvar then
write LogMessage to t.fvar, FileName
else
call DSLogWarn("Failed to write file ":FileName:" to directory ":PathName, "RetrieveLogToFile")
GoTo ExitFunction ;
end
end
else
call DSLogWarn("Failed to open directory ":PathName, "RetrieveLogToFile")
GoTo ExitFunction ;
end

Call DSLogInfo ("Created Log File ": PathName : "/" : FileName:" status=":Status(), "RetrieveLogToFile")
Answer=LogMessage
GoTo EndFunction ;

ExitFunction:
Answer=LogMessage
GoTo EndFunction ;

EndFunction:
ErrCode = DSDetachJob(JobHandle)
Ans=Answer



Even when we test the routine it gives the truncate warning message in display.
Any suggestions please.
Plot No – B4, Jeevan Akshyay apts
8/14, 2nd Main Road, Jaya Nagar
Tambaram sanitorium,
Chennai-47.
smandepudi@gmail.com
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

The reason is DSGetLogSummary() which is only returning the first portion of the message. You need to get the EventId from the summary array, then use the DSGetLogEntry() function to get the full message.


p.s. It helps if you put code tags around your code to make it more legible.
sateeshbabu
Participant
Posts: 48
Joined: Sat Oct 22, 2005 9:56 am

Post by sateeshbabu »

Hi ArndW,

Thanks for all your inputs,

We would be able to get the full length warning but in between we are getting some junk characters(<FD>) as well the log is not in proper display,as it is giving all the "Environment variable settings: (...)" Whatever present inside this too,it won't be a big issue but i feel this log as an attachment would be very long.

Inside the loop we added like this

If Str<>"" Then
NLines=NLines+1
EventId=Field(Str,"\",1)
logMsg=DSGetLogEntry(JobHandle,EventId)
TimeStamp=Field(Str,"\",2)
EvntMsg=Field(logMsg,"\",4).


Could you please suggest us how could we rectify this.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

The extra character is a @FM character, which you can convert to a carriage return with CONVERT(@FM,CHAR(13),YourString).
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Spend some time learning about dynamic arrays in DataStage BASIC programming. All multi-line log entries are dynamic arrays. In particular, the dynamic array delimiter characters, such as 0xFD, are not junk. 0xFD is (contrary to what Arnd assumed) a "value mark" character, which is represented by the @VM system variable. You can convert this to space with

Code: Select all

Convert(@VM, " ", TheString)
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
sateeshbabu
Participant
Posts: 48
Joined: Sat Oct 22, 2005 9:56 am

Post by sateeshbabu »

Arndw\Ray,

Thanks for all your inputs,Now we would be able to get the proper log information.

We used Convert(@VM, char(10), TheString)
sateeshbabu
Participant
Posts: 48
Joined: Sat Oct 22, 2005 9:56 am

Post by sateeshbabu »

Arndw\Ray,

Thanks for all your inputs,Now we would be able to get the proper log information.

We used Convert(@VM, char(10), TheString)
Post Reply