Call DSLogInfo to file??

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
jshurak
Participant
Posts: 74
Joined: Mon Jan 09, 2006 12:39 pm

Call DSLogInfo to file??

Post by jshurak »

We've been tinkering with ideas for compiling metrics for datastage. One idea has been to use the DSJ.JOBSTATUS, throwing it into a variable. But i'm not sure where to go from here. What the overall goal is to write the job name to a text file, format then load it into our data warehouse. Any ideas? Thanks ahead of time!
narasimha
Charter Member
Charter Member
Posts: 1236
Joined: Fri Oct 22, 2004 8:59 am
Location: Staten Island, NY

Re: Call DSLogInfo to file??

Post by narasimha »

jshurak wrote:What the overall goal is to write the job name to a text file, format then load it into our data warehouse.
If all you want is the job name, use the DS Macro DSJobName
Narasimha Kade

Finding answers is simple, all you need to do is come up with the correct questions.
loveojha2
Participant
Posts: 362
Joined: Thu May 26, 2005 12:59 am

Post by loveojha2 »

You can use
DSGetJobInfo (JobHandle, DSJ.JOBSTATUS)
for the user status. But prior to this you would need to get the handle of the job and after this you would need to release the handle.
Success consists of getting up just one more time than you fall.
loveojha2
Participant
Posts: 362
Joined: Thu May 26, 2005 12:59 am

Post by loveojha2 »

For jobnames you can use

Code: Select all

SELECT NAME FROM DS_JOBS WHERE NAME NOT LIKE '\\%'
You can use it inside the Universe Stage.
Success consists of getting up just one more time than you fall.
jshurak
Participant
Posts: 74
Joined: Mon Jan 09, 2006 12:39 pm

Post by jshurak »

thanks for the replies.

I made a mistake in the original post.
What the overall goal is to write the job name to a text file, format then load it into our data warehouse.
What i meant was job status.

I've never used the universe stage, but it sounds like it might be what i'm looking for. Is DS_JOBS a standard datastage table?
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

DS_JOBS is a standard DataStage table, but does not contain job status. The DS_JOBS table records the job's type and category, and an internal number that DataStage uses to refer to the job in all other aspects.

However, you get a job handle via a call to DSAttachJob(), you do not need to be aware that DS_JOBS exists.

Code: Select all

$IFNDEF JOBCONTROL.H
$INCLUDE DSINCLUDE JOBCONTROL.H
$ENDIF

hJob = DSAttachJob("MyJobName", DSJ.ERRNONE)

JobStatus = DSGetJobInfo(hJob, DSJ.JOBSTATUS)
* 0 = running, 1 = finished, 2 = warnings, 3 = aborted, etc.
* Negative values such as DSJE.BADHANDLE are errors.

If JobStatus >= 0
Then
   Ans = JobStatus
   ErrCode = DSDetachJob(hJob)
End
Else
   Ans = JobStatus
   Call DSLogWarning("Job could not be attached.", "GetJobStatus")
End
Warning: if you execute this code from a running job, the job status will always be "running".
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply