Warning log capture

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
shrey3a
Premium Member
Premium Member
Posts: 234
Joined: Sun Nov 21, 2004 10:41 pm

Warning log capture

Post by shrey3a »

Hi Gurus,

We have around 1000 jobs running every night.
Usually when job fails/aborts (threshold is 1 warning) ..on call person fix it and rerun the job so the entry is there in job log but its not for the last run.

we thought of automating it and designed the job which picks up all the jobs finished with warnings but this do not work in our scenario as oncall person at night has fixed the job and reran it so this job will not pickup the job finished with warnings.

Is there is any method to capture all jobs finished with warnings after the nightly cycle is finished(nightly cycle will only finish when all jobs are finished ok without warning) but we want to capture the jobs which actually got fixed or errored out at night.

Thanks,
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Open Director, and uncheck Show Categories in the View menu. Then click on the heading of the Status column. Jobs will be sorted by status; Aborted will be at the top.

To automate this process you will need to create a routine that iterates through all the jobs and selects those with the particular job status in question if the run date is within the previous 24 hours.

Code: Select all

FUNCTION BadJobRuns(IgnoreMe)
* Returns comma-delimited list of job names with exit status Warnings or Abort.
$IFNDEF JOBCONTROL.H
$INCLUDE DSINCLUDE JOBCONTROL.H
$ENDIF

Ans = ""

Open "DS_JOBS" To fDSJobs
Then
   Select fDSJobs To 9
   Loop
   While ReadNext JobName From 9
      If JobName Matches "1A0X"
      Then
          hJob = DSAttachJob(JobName, DSJ.ERRNONE)
          JobStatus = DSGetJobInfo(hJob, DSJ.JOBSTATUS)
          If JobStatus = DSJS.RUNWARN Or JobStatus = DSJS.RUNFAILED
          Then
               Ans<-1> = JobName  ; * add to dynamic array of names
          End
          ErrCode = DSDetachJob(hJob)
      End
   Repeat
   Convert @FM To "," In Ans
   Close fDSJobs
End

RETURN(Ans)
Last edited by ray.wurlod on Thu Mar 01, 2007 8:31 pm, edited 2 times in total.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
shrey3a
Premium Member
Premium Member
Posts: 234
Joined: Sun Nov 21, 2004 10:41 pm

Post by shrey3a »

Hi Ray,

As per your suggestion I created the routine but...

Its giving me below error , I have argument defined as IgnoreMe and routine name is BadJobRuns

Compiling: Source = 'DSU_BP/DSU.BadJobRuns', Object = 'DSU_BP.O/DSU.BadJobRuns'
*******************************************
WARNING: Variable 'DSJobs' never assigned a value.
WARNING: Variable 'DSJS.RUNFAIL' never assigned a value.

As in routine code provided by you its

Open "DS_JOBS" To fDSJobs

and

If JobStatus = DSJS.RUNWARN Or JobStatus = DSJS.RUNFAIL

We are on 7.1 Unix box.

Regards,
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Coding from memory! Have edited code.

Select fDSJobs To 9

DSJS.RUNFAILED
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
shrey3a
Premium Member
Premium Member
Posts: 234
Joined: Sun Nov 21, 2004 10:41 pm

Post by shrey3a »

[quote="ray.wurlod"]Open Director, and uncheck Show Categories in the View menu. Then click on the heading of the Status column. Jobs will be sorted by status; Aborted will be at the top.

To automate this process you will need to create a routine that iterates through all the jobs and selects those with the particular job status in question if the run date is within the previous 24 hours.]

Hi,

We have created the routine it picks up the job finished with warnings or abort but if at night time oncall person fixes the job and run it succesfully then routine do not picks up that job. Actually we wanted to identify which job gave the problem even it was fixed at night and ran succesfully after the abort.

Regards,
Munish
ganesh123
Participant
Posts: 70
Joined: Tue Feb 20, 2007 3:22 pm
Location: NJ,USA
Contact:

Post by ganesh123 »

Sorry but just want to know Shrey that the routine is "After Job Sub-routine" i.e a shell script ? And how you get the info of all job's status ?
I mean what exactly you do ? You run the sequencer and scan all the jobs which are in the sequencer and then report the failed job or what ?

Sorry too many questions ? Just curious... :roll:
If women didn't exist, all the money in the world would have no meaning.
-- Aristotle Onassis
shrey3a
Premium Member
Premium Member
Posts: 234
Joined: Sun Nov 21, 2004 10:41 pm

Post by shrey3a »

[quote="ganesh123"]Sorry but just want to know Shrey that the routine is "After Job Sub-routine" i.e a shell script ? And how you get the info of all job's status ?
I mean what exactly you do ? You run the sequencer and scan all the jobs which are in the sequencer and then report the failed job or what ?}

The routine is transform function , we are trying to capture name of all jobs which has filed/ warning for the nightly batch cycle but the code provided by Ray it does captures all the jobs which are still in warning/ aborted stage but our problem is we want to capture the names of jobs which even was corrected by oncall person at night and was ran succesffuly but they did fail first time during the nightly batch cycle.

thanks
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

A job's status is always its current status. That's all you mentioned in your specification.

To get previous status requires going to the job log, even assuming that you don't have auto-purge up to previous 1 job run enabled. It would be substantially different code.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
shrey3a
Premium Member
Premium Member
Posts: 234
Joined: Sun Nov 21, 2004 10:41 pm

Post by shrey3a »

ray.wurlod wrote:A job's status is always its current status. That's all you mentioned in your specification.

To get previous status requires going to the job log, even assuming that you don't have auto-purge up to previous 1 job run enabled. It would be substantially different code.
Hi Ray,

Sorry for the confusion!. We can set the autopurge log to keep last 3 run entries or whatever you suggest but our aim to is to grab the job names which finished or aborted for the last run even though they were restarted again and ran succesfully....its usually a if job fails we fix and it runs succesfully for the subsequent run.

Regards
ganesh123
Participant
Posts: 70
Joined: Tue Feb 20, 2007 3:22 pm
Location: NJ,USA
Contact:

Post by ganesh123 »

Shrey can you please elaborate, what did you do so far ? I am really interested in your topic but cannot proceed. Like what are the stages you using and how you grab the input and all ? I mean exactly from start in detail please.

It would be helpful to others too. I would really appreciate that.
If women didn't exist, all the money in the world would have no meaning.
-- Aristotle Onassis
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Algorithm design:
Find current status. If "Finished OK" then do the remainder.
Find start of current run.
Find newest "job finished" message prior to that timestamp.
Get status from that event.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
shrey3a
Premium Member
Premium Member
Posts: 234
Joined: Sun Nov 21, 2004 10:41 pm

Post by shrey3a »

ray.wurlod wrote:Algorithm design:
Find current status. If "Finished OK" then do the remainder.
Find start of current run.
Find newest "job finished" message prior to that timestamp.
Get status from that event.
Hi Ray,

Tried for 4 hours but seems my skills of playing with DS commands are lil weak so no luck till now.

Regards,
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Algorithm design:
Find current status (DSGetJobInfo(hJob, DSJ.JOBSTATUS)). If "Finished OK" (DSJS.RUNOK) then do the remainder.
Find start of current run (DSGetJobInfo(hJob,DSJ.JOBSTARTTIMESTAMP)).
Find newest "job finished" message prior to that timestamp (EventNo = DSGetNewestLogId(hJob,...)).
Get status from that event (DSGetLogEvent(hJob, EventNo)).
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
urshit_1983
Participant
Posts: 73
Joined: Wed Jun 28, 2006 3:27 pm
Location: NJ

Post by urshit_1983 »

Shrey can you please post the algorithm, what actually you did and how you solved it ?
"Nobody is expert in Everything,
But Everybody is expert in Something."
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

It is available in the same thread, but with less than 3 cents a day. Grab the Premium membership quickly and get the full essence of Dsxchange.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
Post Reply