Set Environment Variable

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
bbobpop1
Participant
Posts: 29
Joined: Sun Jul 20, 2008 9:55 am

Set Environment Variable

Post 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
nagarjuna
Premium Member
Premium Member
Posts: 533
Joined: Fri Jun 27, 2008 9:11 pm
Location: Chicago

Re: Set Environment Variable

Post 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
Nag
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

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

"You can never have too many knives" -- Logan Nine Fingers
bbobpop1
Participant
Posts: 29
Joined: Sun Jul 20, 2008 9:55 am

Post 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
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

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

"You can never have too many knives" -- Logan Nine Fingers
bbobpop1
Participant
Posts: 29
Joined: Sun Jul 20, 2008 9:55 am

Post 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
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

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

"You can never have too many knives" -- Logan Nine Fingers
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

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

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
bbobpop1
Participant
Posts: 29
Joined: Sun Jul 20, 2008 9:55 am

Post 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
Post Reply