Obtaing Job sequence Info

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
owow
Participant
Posts: 13
Joined: Mon Jan 08, 2007 6:47 am
Location: Oxford
Contact:

Obtaing Job sequence Info

Post 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]
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post 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.
owow
Participant
Posts: 13
Joined: Mon Jan 08, 2007 6:47 am
Location: Oxford
Contact:

Post 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 [ ...
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post 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.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Out of curiosity, what did the DSGetLinkInfo() call return?
owow
Participant
Posts: 13
Joined: Mon Jan 08, 2007 6:47 am
Location: Oxford
Contact:

Post by owow »

Data Stage version 6 returned DSJE.NOTINSTAGE (Minus 8 )
ArndW wrote:Out of curiosity, what did the DSGetLinkInfo() call return? ...
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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.
-craig

"You can never have too many knives" -- Logan Nine Fingers
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post 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)
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post 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.
Mamu Kim
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You could hard-code the required names in the Routine activity and create a routine that accepted them as arguments.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
boxtoby
Premium Member
Premium Member
Posts: 138
Joined: Mon Mar 13, 2006 5:11 pm
Location: UK

Post 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.
Bob Oxtoby
boxtoby
Premium Member
Premium Member
Posts: 138
Joined: Mon Mar 13, 2006 5:11 pm
Location: UK

Post 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.
Bob Oxtoby
Post Reply