Page 1 of 1

Output of a file as a parameter

Posted: Thu Sep 06, 2007 12:12 am
by hamzaqk
Hi all,

I have two jobs. the first one gets the max val for a column from a table and stored that in a file.

odbc---->> seq file

The second generates surrogate keys for the incoming records.

seq file---- > surrogate key gen----- > output

what i want to do is to pass the value which is stored in the file as the result of the first job run to the parameter in the second job.

in short.. i want the result of the first job to be the 'start value' of the surrogate key generator stage in the second job.

How can i do this ?

Posted: Thu Sep 06, 2007 12:20 am
by ray.wurlod
Easiest would be to read the file and pass its value into the second job as a job parameter. You would do this with an Execute Command activity in a job sequence.

Posted: Thu Sep 06, 2007 12:47 am
by hamzaqk
thanks ray. can you please let me know what is the command to read the file ? what should i write in the command line of Execute Command activity .

Posted: Thu Sep 06, 2007 1:14 am
by Maveric
After the first job writes the value to the sequential file, use UserVariable Activity to read the value from the file. And when writing the variable to the file write it as VarName=Value, VarName being the variable name used in job 2. Use get GetParameterValueFromFile() in UserVariable Activity to read the value.

Posted: Thu Sep 06, 2007 6:07 am
by ag_ram
Hamzaq

You can use a CAT statement in the shellscript (Execute command activity) and get that to the next job

I have a sample where i do

cat <filename>|head -1

and get that to my next job .

Posted: Thu Sep 06, 2007 6:21 am
by gateleys
Maveric wrote:Use get GetParameterValueFromFile() in UserVariable Activity to read the value.
Is there such a function available? Well, of course, if you have not custom coded it!!!!

Posted: Thu Sep 06, 2007 6:23 am
by gateleys
gateleys wrote:
Maveric wrote:Use get GetParameterValueFromFile() in UserVariable Activity to read the value.
Is there such a function available? Well, of course, if you have not custom coded it!!!!
Never mind. I didn't notice that it was a PX post. I wanted to know if it was available in Server Ed.

Posted: Thu Sep 06, 2007 3:54 pm
by ray.wurlod
cat filename | tr -d \n

The tr command strips newline characters. Otherwise you could strip them when using the activity variable.
Activity.$Output<1>