Passing parameter values dynamically

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
mohanraj
Participant
Posts: 48
Joined: Sat Mar 25, 2006 12:40 am
Location: bangalore

Passing parameter values dynamically

Post by mohanraj »

Hi Guys

Can anyone help me how can I pass values from a file into parameters randomly.

Thaiks in advance
Mohan
thurmy34
Premium Member
Premium Member
Posts: 198
Joined: Fri Mar 31, 2006 8:27 am
Location: Paris

Post by thurmy34 »

Hi,
I don't understand the randomly thing.
For the rest you can read your file,seek for your parameter and use the DSSetParam function.
Hope This Helps
Regards
Kirtikumar
Participant
Posts: 437
Joined: Fri Oct 15, 2004 6:13 am
Location: Pune, India

Post by Kirtikumar »

The function mentioned should be used as after job routine. The routine reads the parameter values from file and then if the param exists in job, will pick up the value from file.
Regards,
S. Kirtikumar.
mohanraj
Participant
Posts: 48
Joined: Sat Mar 25, 2006 12:40 am
Location: bangalore

Post by mohanraj »

Hi thurmy
thurmy34 wrote:Hi,
I don't understand the randomly thing.
For the rest you can read your file,seek for your parameter and use the DSSetParam function.
My job is like this Seq---->Transformer----->Oci
My seq file should read data from files based on the file names kept in another file. I mean how can I pass values from this file into parameters.

Please explain in detail

Thanks in advance
Mohan
loveojha2
Participant
Posts: 362
Joined: Thu May 26, 2005 12:59 am

Post by loveojha2 »

Create a Routine which will read the parameter from the file.

Call this routine in a Sequence Job,
Call your Server Job from this Sequence job with a parameter having the value as the return value from the routine activity.

Use this parameter in the server job as the name of the sequential file.
Success consists of getting up just one more time than you fall.
loveojha2
Participant
Posts: 362
Joined: Thu May 26, 2005 12:59 am

Post by loveojha2 »

If the process is to be done for more than one file.
Then include the activity of calling the routine and server job in between loop activity.

But with that you would need to tweak the routine code a bit.

Or you could read all the file names once and concate them with spaces and in server use them with the cat command.
Success consists of getting up just one more time than you fall.
thurmy34
Premium Member
Premium Member
Posts: 198
Joined: Fri Mar 31, 2006 8:27 am
Location: Paris

Post by thurmy34 »

Hi,
Here is my own "seek a parameter" routine.
Arg1 is the name of the parameter we want.

Code: Select all

* Open The File
      OpenSeq ParamFile to paramtemp Else Ans = "Not Found  ":ParamFile 

* Read the File 
     loop
      while ReadSeq param from paramtemp
         varParameter = upcase(field(param,'=',1))
         varName = upcase(Arg1)
         begin case

            Case varParameter = varName
               Ans = field(param,'=',2)
               EXIT

            Case varParameter <> varNom
               Ans = ' NOT FOUND
         End Case

      repeat

      CloseSeq paramtemp
We call it in a job control for each parameter of the job we will launch then we use DSSetParam.
Hope This Helps
Regards
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Use a job sequence with a Start Loop and End Loop activity. Set up your loop as a "list of things" loop generated by listing the file of file names. Invoke the job within the loop.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
thurmy34
Premium Member
Premium Member
Posts: 198
Joined: Fri Mar 31, 2006 8:27 am
Location: Paris

Post by thurmy34 »

Hi Ray
Your solution is as always interesting but i can't find the start/end loop activity in the designer.
Hope This Helps
Regards
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

You'd need to be on a 7.5.x version of DataStage to have those stages. If you don't have them, you are stuck with writing your own 'batch' job control and controling the looping yourself, as already noted.
-craig

"You can never have too many knives" -- Logan Nine Fingers
thurmy34
Premium Member
Premium Member
Posts: 198
Joined: Fri Mar 31, 2006 8:27 am
Location: Paris

Post by thurmy34 »

I'm in 7.1 r1 so i'm stuck.

Thank you anyway
Hope This Helps
Regards
Post Reply