Getting log info for multi-instance job

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
MukundShastri
Premium Member
Premium Member
Posts: 103
Joined: Tue Oct 14, 2003 4:07 am

Getting log info for multi-instance job

Post by MukundShastri »

In our application job is coded presently such that a control job clears RT_LOG file for a job J1 and then runs the job J1 . After J1 is run successfully the control job copies the log in RT_LOG_nnnn file of job J1 to a xxx.log file for monitoring/archive purpose.

Due to new requirements we are needed to make job J1 as a multi-instance job. But we still want to follow the process of clearing and copying log for each separate instance , before and after the successful run of each instance of job J1 respectively.

Problem is I am not able to identify separate RT_LOG file for the instances (say J1.026 and J1.027) of the job J1 as the Job number available in DS_JOBS is only for J1 and not for its instances. Your comments please !!

Also ,can someone throw light on the following issues:

1.0] If I want to clear the log for J1.026 when J1.027 is running , how it can be done.
2.0] Also If I want to copy the log of instance J1.026 and J1.027 separately, how it can be done ?

Thanks

Mukund
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

The instance id is a field in the RT_LOG file.
Mamu Kim
MukundShastri
Premium Member
Premium Member
Posts: 103
Joined: Tue Oct 14, 2003 4:07 am

Post by MukundShastri »

Which query should I write to get the Log information from RT_LOG file for particular instance_id ??

Thanks

Mukund
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

How are getting the log for a regular job? Post your code.
Mamu Kim
MukundShastri
Premium Member
Premium Member
Posts: 103
Joined: Tue Oct 14, 2003 4:07 am

Post by MukundShastri »

Please see below the code that gets RT log and copies it to a unix log file
I want to know how do I change the read loop so as to pick up instance Id was log details of a job:
********************************************************************************
* open DS log file
********************************************************************************

L.DSLogFile = "RT_LOG":L.JobNo
Open L.DSLogFile To F.DSLogFile Else
L.Msg = "Could not open DS log file ":Quote(L.DSLogFile)
L.Dummy = srLogMsg("F",L.Msg)
End


********************************************************************************
* dump DS log file to archive file
********************************************************************************

L.Cmd = "SELECT ":L.DSLogFile:" WITH TIMESTAMP > 0 BY TIMESTAMP"
Execute L.Cmd Capturing L.Output Returning L.RC
L.NewLine = Char(10)

Loop
ReadNext L.ID Else Exit
Read L.Record From F.DSLogFile, L.ID Then
L.Temp = DSRMessage(L.ID, L.Record<10>, Raise(L.Record<5>))
If L.Temp Matches "LinkReport(0X)" Then
; * do nothing - skip these horrid records
End Else
L.Msg = L.Record<3>:','
L.Msg := Field("Info,Warning,Fatal,Reject,Started,Reset,Error,Debug",",",L.Record<1>):L.NewLine:L.NewLine
L.Msg := Convert(@AM:@VM, L.NewLine:L.NewLine, L.Temp):L.NewLine
L.Msg := "============================================================"

WriteSeq L.Msg To F.LogFile Else
L.Msg = "Could not write to log file ":Quote(I.LogFile)
L.Dummy = srLogMsg("F",L.Msg)
End
End
End
Repeat
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

Please do Alt-C around your code to save formating. You will need to add the EVAL to your WITH clause.

Here is the SQL:

Code: Select all

select
   @ID,
   TIMESTAMP,
   SEVERITY,
   EVAL "@RECORD<7>" AS INSTANCE_NAME,
   FULL.TEXT
from
   RT_LOG657
where
   EVAL "@ID" NOT LIKE '//%'
   AND INSTANCE_NAME = 'Load1TelecastDimStg'
order by 
   TIMESTAMP
;
Mamu Kim
Post Reply