Page 1 of 1

Passing parameter values dynamically

Posted: Tue Sep 26, 2006 11:50 pm
by mohanraj
Hi Guys

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

Thaiks in advance
Mohan

Posted: Wed Sep 27, 2006 12:11 am
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.

Posted: Wed Sep 27, 2006 12:22 am
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.

Posted: Wed Sep 27, 2006 12:25 am
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

Posted: Wed Sep 27, 2006 12:29 am
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.

Posted: Wed Sep 27, 2006 12:32 am
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.

Posted: Wed Sep 27, 2006 12:35 am
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.

Posted: Wed Sep 27, 2006 1:23 am
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.

Posted: Wed Sep 27, 2006 7:10 am
by thurmy34
Hi Ray
Your solution is as always interesting but i can't find the start/end loop activity in the designer.

Posted: Wed Sep 27, 2006 7:31 am
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.

Posted: Wed Sep 27, 2006 7:35 am
by thurmy34
I'm in 7.1 r1 so i'm stuck.

Thank you anyway