Page 1 of 1

Call DSLogInfo to file??

Posted: Tue Aug 08, 2006 2:41 pm
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!

Re: Call DSLogInfo to file??

Posted: Tue Aug 08, 2006 3:07 pm
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

Posted: Tue Aug 08, 2006 10:14 pm
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.

Posted: Tue Aug 08, 2006 10:16 pm
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.

Posted: Wed Aug 09, 2006 6:01 am
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?

Posted: Wed Aug 09, 2006 6:16 am
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".