Page 1 of 2

Passing parameters in a sequencer

Posted: Tue Sep 05, 2006 8:43 am
by rodre
Hello,
I have a routine that reads the parameters from a file into an array like this:
value1, value2, value3, .....etc
My questions are: 1) How do I pass these parameters in a sequencer through a routine and 2) the same parameters into the another sequencers?

Each sequencer might have several server jobs and routines that use some of these parameters.

The sequencer looks something like bellow:

Code: Select all

Sequencer1------->Sequencer2------>Sequencer3
Thanks,
Rodre

Posted: Tue Sep 05, 2006 9:36 am
by keshav0307
did you try using the User variable activity, and when passing the values to parameter, use field function..

Posted: Tue Sep 05, 2006 10:13 am
by rodre
Thank you for your response, but how do you use User variable activity in sequencer?

Posted: Tue Sep 05, 2006 10:42 am
by kris007
When you ask how, is it where do you place that stage in the JobSequence or how do you call the routine within the UserVariableActivity stage or is it both?

Posted: Tue Sep 05, 2006 12:17 pm
by kduke
There is a routine activity stage as well. You need to create a user variable before you use it. So if you need a parameter calculated then you can call either a routine activity or create a user variable before or both. In the formula for a user variable you can call routines as well just like in any derivation.

Posted: Tue Sep 05, 2006 1:04 pm
by rodre
When you ask how , is it where do you place that stage in the JobSequence or how do you call the routine within the UserVariableActivity stage or is it both?
I found the user variable stage and I will assume it goes before the job sequence and from there I can call my parameters array routine (thanks to finding in this site) but from there, how do you change the parameters set already in the sequencer with the ones in the parameter array? and once is set with the new parameters can they be used for the subsequent Sequencers?

Posted: Tue Sep 05, 2006 4:48 pm
by ray.wurlod
NO, the User Variables activity goes IN the job sequence. Its variables are accessible only to activities downstream of the User Variables activity.

Posted: Fri Sep 15, 2006 9:11 am
by splayer
I created a variable in the user variable activity. I have a job activity stage after that in the sequencer. How do I populate the variable in the user variable activity by callling the job in the job activity stage?

Posted: Fri Sep 15, 2006 10:10 am
by kris007
splayer wrote:How do I populate the variable in the user variable activity by callling the job in the job activity stage?
You don't populate user variable by calling the job. You use the variable created in the UserVariableActivity Stage in the downstream Job activity stage.

Posted: Fri Sep 15, 2006 12:37 pm
by splayer
Ok. I have the job activity stage as a downstream activity from the user activity stage. I have created the variable in the user activity stage. Now, in my downstream job activity stage, how do I store a value in the variable of the user activity stage?

So let's say I have:

UA ---> JA1 ----> JA2 -----> JA3 ------> JA4

UA has a variable called Var1.

In JA1, I would like to read a value from a file and set Var1 to that value, let's say 5. Then in JA4, I would like to increase the value by 1 and write back the value to the file.

Posted: Fri Sep 15, 2006 1:39 pm
by kduke
You cannot do it directly. You have to write it somewhere in the job so the sequence can read it using UtilityHashLookup or a similar routine. The surrogate key routine is a similar concept. Some process needs to put the first value in SDKSequences hashed file. Each call to the routine adds one to the value and writes it back. Look at this routine's code. It is very simple. This does not need to be a surrogate key. The same concept would work for last run date. Job1 select max(extract_date) from my_fact_table and writes to hashed file HF_ETL_CHECKPOINT. Next a user variable is assigned this value using a call to routine UtilityHashLookup.

Posted: Fri Sep 15, 2006 3:56 pm
by splayer
This is what I did. I have a hash file with 2 columns, KeyCol and ValueCol. I just have one row in there with values of 1 and 0. I have a job which has transformer and hash file stage. In the transformer, I have the expression as
UtilityHashLookup("/mypath/HashFile", 1, 1)

where HashFile is the name of the hash file being looked up. However, in my destination hash file I don't see any data. My eventual objective is to replace this value of 0 with a value of 1. For now, I am just wrting to a different hash file.

Posted: Fri Sep 15, 2006 5:17 pm
by kduke
How are you updating the hashed file?

Posted: Fri Sep 15, 2006 8:09 pm
by splayer
This is the scenario I have:

SeqFileStage ----> Transformer -----> HashFileStage

The SeqFileStage is there just to prevent compiler errors. It has no role. In the transformer, I look up the hash file as:
UtilityHashLookup("/MyPath/JCF_Hash", 1, 1)

1: KeyValue
1: Value position. Neither 1 nor 2 works.

Posted: Fri Sep 15, 2006 9:20 pm
by kduke
Your key to the hashed file is 1? What was your key in the job you described?