Passing parameters in a 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

rodre
Premium Member
Premium Member
Posts: 218
Joined: Wed Mar 01, 2006 1:28 pm
Location: Tennessee

Passing parameters in a sequencer

Post 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
keshav0307
Premium Member
Premium Member
Posts: 783
Joined: Mon Jan 16, 2006 10:17 pm
Location: Sydney, Australia

Post by keshav0307 »

did you try using the User variable activity, and when passing the values to parameter, use field function..
rodre
Premium Member
Premium Member
Posts: 218
Joined: Wed Mar 01, 2006 1:28 pm
Location: Tennessee

Post by rodre »

Thank you for your response, but how do you use User variable activity in sequencer?
kris007
Charter Member
Charter Member
Posts: 1102
Joined: Tue Jan 24, 2006 5:38 pm
Location: Riverside, RI

Post 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?
Kris

Where's the "Any" key?-Homer Simpson
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post 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.
Mamu Kim
rodre
Premium Member
Premium Member
Posts: 218
Joined: Wed Mar 01, 2006 1:28 pm
Location: Tennessee

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

Post 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.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
splayer
Charter Member
Charter Member
Posts: 502
Joined: Mon Apr 12, 2004 5:01 pm

Post 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?
kris007
Charter Member
Charter Member
Posts: 1102
Joined: Tue Jan 24, 2006 5:38 pm
Location: Riverside, RI

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

Where's the "Any" key?-Homer Simpson
splayer
Charter Member
Charter Member
Posts: 502
Joined: Mon Apr 12, 2004 5:01 pm

Post 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.
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post 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.
Mamu Kim
splayer
Charter Member
Charter Member
Posts: 502
Joined: Mon Apr 12, 2004 5:01 pm

Post 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.
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

How are you updating the hashed file?
Mamu Kim
splayer
Charter Member
Charter Member
Posts: 502
Joined: Mon Apr 12, 2004 5:01 pm

Post 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.
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

Your key to the hashed file is 1? What was your key in the job you described?
Mamu Kim
Post Reply