I ran the below routine which writes logs to Sequential somewhere picked up from this forum.
But it is just writing very fews logs instead of whole logs.
Pls guide what changes are required in this routine to get whole log written to sequential file.
Thanks
Prashant
$IFNDEF JOBCONTROL.H
$INCLUDE DSINCLUDE JOBCONTROL.H
$ENDIF
StartDate = DSGetJobInfo (DSJ.ME, DSJ.JOBSTARTTIMESTAMP)
SummaryArray = DSGetLogSummary (DSJ.ME,DSJ.LOGINFO,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<-1>=EventId:" ":TimeStamp:" ":EventMessage
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
x=Answer
ValidOpen = @FALSE
filename = "/ascl/dsadm/Ascential/DataStage/Projects/LETS/LogToSequentialFile_PA.txt"
OPENSEQ filename TO FILE Then
ValidOpen = @TRUE
End Else
CREATE FILE Then ValidOpen = @TRUE
End
If NOT(ValidOpen) Then
Call DSLogFatal("Could not create the file: ":filename, "OutputFile")
End
AM.CNT = DCOUNT(x, @AM)
For i=1 to AM.CNT
WRITESEQ x TO FILE else
Call DSLogFatal("Could not update the file: ":filename, "OutputFile")
End
Next i
WEOFSEQ FILE
ErrorCode = 0 ;* set this to non-zero to stop the stage/job
Ans =1
ErrorCode = 0 ;* set this to non-zero to stop the stage/job
Routine for writing Log to Sequential file
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 108
- Joined: Wed Jul 28, 2004 7:15 am
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
EventMessage is wrong. The message begins in field number 4, and may include backslashes.
You want something likeStr was a poor choice of variable name, since it is also the name of an intrinsic function.
Your code is horribly cumbersome. You process the log information twice. Further, you're reading the log from a job that is still running; you will never get the "job finished" event.
Presumably the middle loop is intended to remove double quote characters. You could more easily have used: to achieve this end.
You want something like
Code: Select all
Field(Str, "\", 4, 999)
Your code is horribly cumbersome. You process the log information twice. Further, you're reading the log from a job that is still running; you will never get the "job finished" event.
Presumably the middle loop is intended to remove double quote characters. You could more easily have used:
Code: Select all
Answer = Convert('"', '', Answer)
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.