retrieve job variable from sequencer

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
rtaurino
Participant
Posts: 3
Joined: Tue Nov 22, 2005 7:22 am

retrieve job variable from sequencer

Post by rtaurino »

Hi all,
I tried to find it in the forum but what I found was not ok for my needs.

What I need is a easy way to:
1) set something (variabile/status/whatever) in a transformer stage into a job server
2) read that "something" from a sequencer and use it in a Trigger or similar, to change the flow of the sequencer.

- I read about UserStatus but is seems to be valid only inside the job and anyway there is no meaning to modify it while the job is running.
- I read about @USERx common variables (but I wasn't able to find them!)
- I read about common variables declared in routines (I made 2 routines, the first for setting a common variabile, the other to read it. The first one is used in the transformer, the other one in the sequencer), but again it seems that the value is lost.
- I tried UserVariabile activity job in the sequencer to declare a variable, then in the job with the transformer i modified it, but when I check the variable afterwards , it is unmodified.

Is there an easy way to control the sequencer flow using the result of a condition nested in a transformer of a job server?

:-)
Thankyou all.
Roberto
srinagesh
Participant
Posts: 125
Joined: Mon Jul 25, 2005 7:03 am

Post by srinagesh »

To conditionally trigger the sequence.. try the following


Try to create an empty file from the transformation file. The name of the file will be different based on different conditions. ie., If condition 1 is true.. then the file name cond1.ind will be generated. if condition 2 is true then the file with name cond2.ind will be generated and so on

In the sequencer, you write your sequences with the wait for file trigger.
Seq1 will start if the file cond1.ind is present
seq 2 will start if the file cond2.ind is present
and so on..

You can control which sequence to run based on the result of ur transformation.

Hope this is helpful

Nagesh
rtaurino
Participant
Posts: 3
Joined: Tue Nov 22, 2005 7:22 am

Post by rtaurino »

Thank Nagesh.

I thought about using a file, but I'd like to find a way to get a value from a job to a sequencer. Shouldn't be nicer?

Anyway thankyou very much, I'll surely use a file is no other method could be used.

Rob
rkdatastage
Participant
Posts: 107
Joined: Wed Sep 29, 2004 10:15 am

Post by rkdatastage »

Hi Srinagesh

your response to the query is appreciable.Thanks for your reply

RK
balajisr
Charter Member
Charter Member
Posts: 785
Joined: Thu Jul 28, 2005 8:58 am

Post by balajisr »

Hi

Try this..

Send the common value to the file.

Write a routine to read the file and return the common value.

In Sequencers add routine activity to invoke the routine.

In job activity access the return value of the routine

Regards
Balaji
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Re: retrieve job variable from sequencer

Post by chulett »

rtaurino wrote:What I need is a easy way to:
1) set something (variabile/status/whatever) in a transformer stage into a job server
2) read that "something" from a sequencer and use it in a Trigger or similar, to change the flow of the sequencer.

- I read about UserStatus but is seems to be valid only inside the job and anyway there is no meaning to modify it while the job is running.
Actually, User Status is 'modifiable' from inside a job while it is running and it is easily picked up in a Sequencer and passed to another job or used in a downstream trigger. Only thing to keep in mind is that only the last data written to it is available after the job completes.

You'll need a custom routine to call DSSetUserStatus in your job, typically one that just calls the function using the input argument and then passes the input argument back out as the answer. Then it is simple to leverage it in a derivation.

In the Sequencer, you reference it as StageName.$UserStatus off the top of my head.
-craig

"You can never have too many knives" -- Logan Nine Fingers
rtaurino
Participant
Posts: 3
Joined: Tue Nov 22, 2005 7:22 am

Re: retrieve job variable from sequencer

Post by rtaurino »

Thank you Craig!

I tried that way before (Routine that calls DSSetUserStatus, but I had some problem on getting the result.. seemed that the code was lost)..

Well, I retried and it works correctly!

Regards,
Roberto
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Excellent! :D
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply