Job Log Routine Refinment

Archive of postings to DataStageUsers@Oliver.com. This forum intended only as a reference and cannot be posted to.

Moderators: chulett, rschirm

Locked
admin
Posts: 8720
Joined: Sun Jan 12, 2003 11:26 pm

Job Log Routine Refinment

Post by admin »

Hi all this is the part of code for dumping log of datastage jobs got from ray. it is working fine. I need to filter it for on severity level five. what is the command syntax for it. i tried following it does not work
* take the seviruty into a variable
Severitycd = LogRecord
if Severitycd = 5
Then
WriteSeq ArchiveLine To ArchiveLog.Fvar
End

the purpose is to write to the file only those record from log file whith Severity level five.

but it gives error, what could be the possible

thanks in advance.
Sudhir

--------------------------------------
Loop
While ReadNext LogID
If Num(LogID)
Then
Read LogRecord From JobLog.Fvar,LogID
On Error
Message = Fatal error reading record ":LogID:" from job log.
Message = Job name = ":JobName$:", log file is":JobLogName:".
Message = Error code = :Status():.
Call DSLogWarn(Message, RoutineName)
ErrorCode = -1
GoTo MainExit
End
Then
ArchiveLine = LogRecord ; * Timestamp
ArchiveLine := " " : LogRecord : " " ; * severitycode

* by sudhir
FullText = Subr("*DataStage*DSR_MESSAGE", LogID,LogRecord, Raise(LogRecord))
FullText = Ereplace(FullText, @VM, LF, -1, -1)
FullText = FullText[1,50]
ArchiveLine := FullText
WriteSeq ArchiveLine To ArchiveLog.Fvar
Else
Message = Unable to append to log file":LogFileName:".
Call DSLogWarn(Message, RoutineName)
ErrorCode = -1
GoTo MainExit
End
End
Else
Message = Selected record ":LogID:" not found in":JobLogName:" file.
Call DSLogWarn(Message, RoutineName)
End
End
Repeat
--------------------------------------
regards
Sudhir
APHOIT/CA$H Datawarehouse Team
(65) 423-7449
admin
Posts: 8720
Joined: Sun Jan 12, 2003 11:26 pm

Post by admin »

Whats the error? Are all the required clauses for the WriteSeq statement present? Based on your code snipped they are not. WriteSeq MUST have at least one of Then and Else, and can optionally have an On Error clause preceding them.

SeverityCode = LogRecord
If SeverityCode = 5
Then
WriteSeq ArchiveLine To ArchiveLog.Fvar
On Error
Message = "System error writing to file. Status() = " : Status()
Call DSLogWarn(Message, RoutineName)
End
Else
Message = "Unable to append to archive log - not at EOF"
Call DSLogWarn(Message, RoutineName)
End ; * end of WriteSeq statement
End ; * end of If statement

> ----------
> From: sudhir.mahendru@db.com[SMTP:sudhir.mahendru@db.com]
> Reply To: informix-datastage@oliver.com
> Sent: Tuesday, 19 September 2000 17:09
> To: informix-datastage@oliver.com
> Subject: Job Log Routine Refinment
>
> Hi all this is the part of code for dumping log of datastage jobs got
> from ray. it is working fine. I need to filter it for on severity
> level five. what is the command syntax for it.
> i tried following it does not work
> * take the seviruty into a variable
> Severitycd = LogRecord
> if Severitycd = 5
> Then
> WriteSeq ArchiveLine To ArchiveLog.Fvar
> End
>
> the purpose is to write to the file only those record from log file
> whith Severity level five.
>
> but it gives error, what could be the possible
>
> thanks in advance.
> Sudhir
[ snip ]
Locked