Page 1 of 1

Set Environment Variable

Posted: Thu Apr 16, 2009 3:15 pm
by bbobpop1
Hi

In a sequence, we have two different jobs depending on one job. Currently we are passing the parameter value to sequence using parameter file.

Now, the design has changed and we need to pass the parameter value from Oracle Database by reading the param table.

Option one:

Read the parameter from Oracle Database and write into existing parameter file.

However with this option, we are not removing the dependency of parameter file completely.

I was trying to add new environment variable and set the value for that for environment variable at runtime. But, didn't find a way to assign a value to Environment Variable at runtime.

Is there any other options using which I can read the parameter from Oracle Database and Pass to the Sequence Variable?


Thanks in Advance.

Thanks
Bob

Re: Set Environment Variable

Posted: Thu Apr 16, 2009 3:36 pm
by nagarjuna
Hi ,
We can pass the value to the job at the runtime by using dsjob.

dsjob -run -param parameter=`cat filename ` projectname jobname . I

think we have to use the option of storing that value in a file .

Thanks

bbobpop1 wrote:Hi

In a sequence, we have two different jobs depending on one job. Currently we are passing the parameter value to sequence using parameter file.

Now, the design has changed and we need to pass the parameter value from Oracle Database by reading the param table.

Option one:

Read the parameter from Oracle Database and write into existing parameter file.

However with this option, we are not removing the dependency of parameter file completely.

I was trying to add new environment variable and set the value for that for environment variable at runtime. But, didn't find a way to assign a value to Environment Variable at runtime.

Is there any other options using which I can read the parameter from Oracle Database and Pass to the Sequence Variable?


Thanks in Advance.

Thanks
Bob

Posted: Thu Apr 16, 2009 4:22 pm
by chulett
Even if you managed to set an environment variable in one job, it wouldn't still be there for any others, being local in scope. What about using USERSTATUS as the mechanism?

Posted: Fri Apr 17, 2009 12:05 pm
by bbobpop1
Hi

USERSTATUS is a good option, however If I have to pass 15-20 parameters, then I need to set the USERSTATUS with comma separated string and assign it to another job using some manipulation..

Is there any way, using which I can assign Parameters of job one to another using sequence?

Can we create our own Variables like $UserStatus and assign them a value at Job Level?

Thanks in Advance.

Bob

Posted: Fri Apr 17, 2009 12:42 pm
by chulett
Sure, a UserVariables stage could be set up to grab values from somewhere and instantiate them for other jobs, including an Oracle table I would think. Unless you pull them all at once and parse out what you need, however, pulling one at a time from a database will be pretty slow I'd wager.

Posted: Fri Apr 17, 2009 1:18 pm
by bbobpop1
Hi Craig,

I am trying to avoid parsing the values and trying to develop a solution in which I can fetch all the values for parameters from Oracle Database in one parallel job, assign each parameter with the value from database and directly (without parsing) pass those parameters (with values) to another job.

So I was trying to set the values for environment variable in a job and use them in a sequence, but the scope of variables stuck me.

Also, If I use the USERSTATUS then I need to set a value in Server Job, I guess we are not using SMP system so unable to see the BASIC Transformer Option in Parallel.

About User Variables:

If I define user variables then to assign value for those user variables I need to fetch the values from another job. And one way I know to assign the user variable is using $USERSTATUS.

Can you please guide me and correct me if I am wrong or on wrong path or misunderstood your suggestion?

Thanks
Bob

Posted: Fri Apr 17, 2009 1:41 pm
by chulett
You cannot 'see' the BASIC Transformer because it's not on the palette by default, you need to add it manually. How to do that has been discussed here several times, a search should find it.

Posted: Fri Apr 17, 2009 1:43 pm
by chulett
One mechanism you could use is the UtilityRunJob() function which lets you run a job from a transformer, one job per record. And if that record contained all of the needed parameters...

Posted: Fri Apr 17, 2009 3:12 pm
by ray.wurlod
You don't need to add anything to the Palette - you can drag stages from the Stage Types branch of the Repository directly into a job design.

Posted: Mon Apr 20, 2009 3:36 pm
by bbobpop1
Hi

Thanks for reply. I was trying to use the utility "UtilityRunJob" as below

UtilityGetRunJobInfo(UtilityRunJob("Depend_Job", "my_date=": DSLink2.STATUS, 0,0),"JobCompletionStatus",'')

I guess, we can only read the value of parameter my_date i.e. "DSLink2.STATUS" in the transformer. (That means in the same job)

Can we read metadata (column name and value) of job one (A) from another Job (B)? Consider a scenario in which Job A will execute first in sequence.

If possible, we can read the value of executed job i.e. parameter job say Job A and use those values in Job B.

Thanks in Advance

Thanks
Bob