Page 1 of 1

Obtaing Job sequence Info

Posted: Tue Jan 23, 2007 6:32 am
by owow

Can anybody help?

Assume the following Job sequence jobseqMY:

Code: Select all

JobAct1  ----------> RoutineAct1
   |      Fail_link1
   |OK1
   |
   v
JobAct2  ---------->  RoutineAct2
   |      Fail_link2
   |OK2
   |
   v
JobAct3 ----------->  RoutineAct3
          Fail_link3
         
The underlying jobs for the job activities JobAct1, JobAct3, JobAct3 are Job1, Job2 and Job3
The underlying routine for all routine activities is rFailure_Handler (The same for all).

The question is:
How can the routine rFailure_Handler obtain the following information:

- The name of the link leading to the routine activity
- The name of the failed job activity
- The name of the underlying job name of the failed job activity.

What I am really after is the last item so I can interogate the failed job info.

I tried DsGetStageInfo , DSGetLinkInfo but they return "DSJE.NOTINSTAGE"
I can pass the job name as a parameter but this is prone to error especially if you want to change the job name later down the line.

Thank you for your help

[/size]

Posted: Tue Jan 23, 2007 7:01 am
by chulett
What kind of 'interrogation' are you planning? A simple notification stage linked to an Exception Handler (since this is version 6 we're talking about) will email out the problem encountered and the job it happened in. Or run all of your failure links to a Sequencer set to 'Any' then to the Notification stage.

Posted: Tue Jan 23, 2007 8:43 am
by ArndW
I'm unsure of whether or not DSGetLinkInfo(DSJ.ME,DSJ.ME,DSJ.ME,DSJ.LINKNAME) will work in a sequence as opposed to a job, but it might solve your problem. If not, I'd add a parameter to your rFailure_Handler routine to include this information.

Posted: Tue Jan 23, 2007 9:02 am
by owow

Thank you.

No, I am afraid DSGetLinkInfo won't work in a sequence (I tried).

Regarding adding a parameter:
Yes, it is a possiblity, but it is one that I am trying to avoid. Although it seems a minor change, typing the job name as parameter is prone to error when many jobs are involved and need to be maintain when job name changes.

ArndW wrote:I'm unsure of whether or not DSGetLinkInfo(DSJ.ME,DSJ.ME,DSJ.ME,DSJ.LINKNAME) will work in a sequence as opposed to a job, but it might solve your problem. If not, I'd add a parameter to your [ ...

Posted: Tue Jan 23, 2007 9:05 am
by DSguru2B
Not really. You get the jobnames from the repository instead of typing it yourself. This way if any jobname changes, it will reflect in your list.

Posted: Tue Jan 23, 2007 9:11 am
by ArndW
Out of curiosity, what did the DSGetLinkInfo() call return?

Posted: Tue Jan 23, 2007 9:17 am
by owow
Data Stage version 6 returned DSJE.NOTINSTAGE (Minus 8 )
ArndW wrote:Out of curiosity, what did the DSGetLinkInfo() call return? ...

Posted: Tue Jan 23, 2007 9:45 am
by chulett
Those functions don't work for Sequence jobs.

I don't believe this is available in 6.x but in 7.x you have Activity Variables so you wouldn't need to hard-code everything. StageName.$JobName springs to mind.

Well worth upgrading, btw.

Posted: Tue Jan 23, 2007 11:12 am
by DSguru2B
A job list has to be present before you get inside your routine. dsjob -ljobs can be used to list all the jobs. Select NAME from DS_JOBS; is a UV command you can run to get all the job names. But i would stick to dsjob as the second one would sieze to exist in versions to come, so I have heard. Refresh the list at the begining of your cycle. Read the jobnames one by one and do your processing. You can use the DSExecute() command to Type filename.txt to spit out the jobname. This will be stored in Output as a dynamic array. Each jobname will be seperated by @FM (a field mark)

Posted: Fri Feb 02, 2007 7:00 am
by kduke
Do an exact search for JobAct and kduke as the poster. One of the posts is viewtopic.php?t=105954&highlight=JobAct

You may need to extract this info before you run your sequence into a hashed file and look it up at run time.

Posted: Fri Feb 02, 2007 2:47 pm
by ray.wurlod
You could hard-code the required names in the Routine activity and create a routine that accepted them as arguments.

Posted: Fri Feb 02, 2007 3:25 pm
by boxtoby
I've just had to think about a similar problem myself and, it its of any interest, here's my situation ....

The DS sequence is launched from a script which is launched by a scheduler:

Script > Seq 1 > Seq 2 > Job 3

The requirement is to return any fatal error message from Job 3 to the script and then to the scheduler. I have found that:

Seq 1 cannot "see" Job 3 at all

Seq 2 gets log messages which refer to the failure of Job 3 but trying to extract the job name from Seq 2's log looks messy to me.

So the plan is to have an end of job routine which uses DSGetLogSummary to retrieve the fatal error message and drop it in to a text file. The script can then retrieve the message from the file and pass it back to the scheduler.

The script will need to create the hard coded fie name and then delete it when finished.

A bit clunky, but achievable, I think

Bob.

Posted: Tue Feb 06, 2007 4:16 pm
by boxtoby
Hi, thanks for the response.

Basically, it's a fiddly area!

I think your idea works as well as any.

One thing that occurred to me from your notes is that you are handling the error with a failure link in the sequence with an error handler routine and then a sequence terminator, I assume.

I used to do this myself until I realised that if you switch on the 'Add checkpoints ... restartable on failure' and 'Automatically handle activities that fail' on the General/Job Properties tab the sequence(s) running the job automatically fail (and restart) when the job fails. Makes the sequence a bit cleaner.

Perhaps you've tried this option already?

(I assume you've checked restart works ok.)

Anyway, good luck!

Bob.