Error in DSAttachJob to status other than "Finished&quo

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
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

You should put code tags around your job listing so we can see the formatted code. This job gets the job status. It does nothing with the job log.

Why do you need this? What are you going to do with the sequential file?
Mamu Kim
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Need more info. What exactly do you want. Do you need the log files of all the jobs in a particular project, or you need particular info from log files for all the jobs? Plus you sure you want to collect the log files of all the jobs in a single sequential file. That file is going to be huge if you have 100 plus jobs.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You need to test explicitly for failure to attach jobs (clearly a job that has not been compiled will not have any run status) and bypass them. Any error in DSAttachJob returns an error code which is an integer less than zero.

Code: Select all

hJob = DSAttachJob(JobName, DSJ.ERRNONE)
JobName = DSGetJobInfo(hJob, DSJ.JOBNAME)
If JobName Matches "'-'1N0N"
Then
   * Failed to attach job
End
Else
   * Job attached OK
   * Process desired job information
   * Don't forget to detach job
   ErrCode = DSDetachJob(hJob)
End
Don't use PRINT statements - you'll never find the output. You need to use WriteSeq to write lines to a file.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
wahil
Participant
Posts: 23
Joined: Tue Oct 25, 2005 11:14 am

Post by wahil »

I need list the log files of all the jobs in a particular project to a sequential file. This routine get job status and logs information too. This will be used to generate statistics about performance of jobs.
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

Just download EtlStats from the links below my signature. That is what it is designed to do. It updates several tables. Just change it to update a sequential file. You need to modify the job GenHtmlJobLog to get the log file records. The job DSJobReportDbDriver runs the job DSJobReportDb which is the one you need to modify. DSJobReportDbDriver can be run for "all" jobs. Modify a couple jobs and you are done.
Mamu Kim
wahil
Participant
Posts: 23
Joined: Tue Oct 25, 2005 11:14 am

Post by wahil »

Hi Kim,

I download EtlStats and its very good but in my company the environment is much "closed". We don't can use send mail, generate html routines, by example.
By this, i did create other jobs and use some routines yours.

The problem now is, who list jobs of other project in job control...

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

Post by kduke »

EtlStats will not work across projects. So you need to install it in the other project.

dsjob can list all jobs in any project.
Mamu Kim
wahil
Participant
Posts: 23
Joined: Tue Oct 25, 2005 11:14 am

Post by wahil »

[quote]EtlStats will not work across projects. So you need to install it in the other project.

dsjob can list all jobs in any project. [/quote]

Kim, ok to dsjobs. I'm tried to change function "GetLastRunLog" routine to work across projects, but the problem is in DSAttachJob function. This fine only to project logged...

The isJobMultipleInstance and GetJobCategory routines i am change and its run fine. I am add + one parameter(ProjName) and put the commands below in the top of the program.

[code]
Cmd = ''
Cmd := 'LOGTO ':aProjName
execute Cmd capturing output returning RtnCode
[/code]
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

Did that work?
Mamu Kim
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

LOGTO within programs is fraught with danger. For example, once you arrive in the new account (this works OK), which VOC file do you have open - that of the new account or that of the account from which you departed?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
wahil
Participant
Posts: 23
Joined: Tue Oct 25, 2005 11:14 am

Post by wahil »

Ok Ray.

I will create all jobs and routines in all the projects(+/- 20) :cry: .

Don't be very beautiful, but...

Ray and Kim, thanks a lot.
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

You should pull out the jobs you do not need and just use the ones you do need. There are lots of jobs that are just to show you how to create metadata from system tables or from the DataStage repository. EtlStats has several jobs which are not used to get row counts. The same is true for the routines.
Mamu Kim
Post Reply