can you override a "Add Environment Variable" parm

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
flashgordon
Premium Member
Premium Member
Posts: 99
Joined: Tue Aug 17, 2004 7:50 am
Location: Boulder, Colorado

can you override a "Add Environment Variable" parm

Post by flashgordon »

Hi,

Are you allowed to override a "Add Environment Variable" parameter with a dsjob -param xx=...? I was reading all the DSJE_BADPARAM discussion and it seemed like the answer might be "NO". Almost all our parameters are $PROJDEF but we would like to override this one at runtime. Is our only option to make it a regular, user defined, job parameter in order to override it at runtime?

... Flash
Flash Gordon
Hyperborean Software Solution
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Honestly, I have no idea never having tried it. Curious if you have and are struggling with 'bad parameter' errors or are we still in the hypothetical?
-craig

"You can never have too many knives" -- Logan Nine Fingers
flashgordon
Premium Member
Premium Member
Posts: 99
Joined: Tue Aug 17, 2004 7:50 am
Location: Boulder, Colorado

Post by flashgordon »

Craig,

I'm having problems. At first I was doing a date parameter and there were dashes in it and I thought that was my problem. So I switched it to a straight character parameter and I am still having the problems.

Error -3 getting information for parameter 'EPMONEOPERATORID'

Status code = -3 DSJE_BADPARAM


I guess it makes sense. If you want $PROJDEF then that's all we're going to allow for that parameter. I'm going to try it as a regular user defined parameter.

... Flash
Flash Gordon
Hyperborean Software Solution
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You should be able to override.
dsjob -run -param $MYPARAM=value project job

The default date format should be YYYY-MM-DD
dsjob -run -param $MYDATEPARAM=2007-12-09 project job

Or maybe it has to be quoted
dsjob -run -param $MYDATEPARAM='2007-12-09' project job

Experiment.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

If the format was wrong (dashes and such) you'd throw a -4 error, the -3 says there isn't a parameter with that name in your job. Don't exclude the $ when doing this, it might be as simple as that. And as Ray notes, dates will need to be in YYYY-MM-DD format.

Let us know if you get this working.
-craig

"You can never have too many knives" -- Logan Nine Fingers
flashgordon
Premium Member
Premium Member
Posts: 99
Joined: Tue Aug 17, 2004 7:50 am
Location: Boulder, Colorado

Post by flashgordon »

Ray/Craig,

We are using autosys here. When we try to say
-param $myparam=2007-04-15
autosys subsitutes '' for $myparam because he can't find $myparam in his env.

Maybe there are some ways around this but they got too painful.

We found an answer to this that I want to share. We found that if in the sequences you subsitute a real sequence parameter as the value for the environment parameter, that value will be passed to the job at execution time.

So in the Sequence stage calling the job in the column called "Name" you specify $MYENVVAR. Then in the column for "Value Expression" you put a "real" (non-environment) parameter. Then in dsjob you override the "real" parameter.

.. Flash
Flash Gordon
Hyperborean Software Solution
flashgordon
Premium Member
Premium Member
Posts: 99
Joined: Tue Aug 17, 2004 7:50 am
Location: Boulder, Colorado

Post by flashgordon »

Ray/Craig,

We are using autosys here. When we try to say
-param $myparam=2007-04-15
autosys subsitutes '' for $myparam because he can't find $myparam in his env.

Maybe there are some ways around this but they got too painful.

We found an answer to this that I want to share. We found that if in the sequences you subsitute a real sequence parameter as the value for the environment parameter, that value will be passed to the job at execution time.

So in the Sequence stage calling the job in the column called "Name" you specify $MYENVVAR. Then in the column for "Value Expression" you put a "real" (non-environment) parameter. Then in dsjob you override the "real" parameter.

.. Flash
Flash Gordon
Hyperborean Software Solution
flashgordon
Premium Member
Premium Member
Posts: 99
Joined: Tue Aug 17, 2004 7:50 am
Location: Boulder, Colorado

Post by flashgordon »

a person reading this might ask "Why do you want to do this". My answer would be that 95% of the time you want to use the environment variable value, but 5% of the time you want to override that value at run time.

Flash
Flash Gordon
Hyperborean Software Solution
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

flashgordon wrote:We are using autosys here. When we try to say
-param $myparam=2007-04-15
autosys subsitutes '' for $myparam because he can't find $myparam in his env.
Just curious, did you try something like:

-param '$myparam=2007-04-15'

or

-param \$myparam=2007-04-15

So that the dollar sign passes as a literal?
-craig

"You can never have too many knives" -- Logan Nine Fingers
flashgordon
Premium Member
Premium Member
Posts: 99
Joined: Tue Aug 17, 2004 7:50 am
Location: Boulder, Colorado

Post by flashgordon »

Craig,

I decided I wanted this bad enough that I wrote a parm testing job. This is straight unix, no autosys. Your ideas abouts quotes and backslash ran the jobs but did not substitue the parameters. This is close to all possible permutations for this problem:

myserv:/ps1/psoftts8/Ascential/DataStage/DSEngine: bin/dsjob -run -mode NORMAL -param $EPMONEOPERATORID=XXXX -wait -jobstatus INSTALL xparmt
Error -3 getting information for parameter ''

Status code = -3 DSJE_BADPARAM
myserv:/ps1/psoftts8/Ascential/DataStage/DSEngine: bin/dsjob -run -mode NORMAL -param EPMONEOPERATORID=XXXX -wait -jobstatus INSTALL xparmt
Error -3 getting information for parameter 'EPMONEOPERATORID'

Status code = -3 DSJE_BADPARAM
myserv:/ps1/psoftts8/Ascential/DataStage/DSEngine: bin/dsjob -run -mode NORMAL -param MYPARAM=XXXX -wait -jobstatus INSTALL xparmt
Waiting for job...
Finished waiting for job
Job Status : (1)

Status code = 1
myserv:/ps1/psoftts8/Ascential/DataStage/DSEngine: cat .dsrel
7.5.1.35
myserv:/ps1/psoftts8/Ascential/DataStage/DSEngine: bin/dsjob -run -mode NORMAL -param '$EPMONEOPERATORID=XXXX' -wait -jobstatus INSTALL xparmt
Waiting for job...
Finished waiting for job
Job Status : (1)

Status code = 1
myserv:/ps1/psoftts8/Ascential/DataStage/DSEngine: bin/dsjob -run -mode NORMAL -param \$EPMONEOPERATORID=XXXX -wait -jobstatus INSTALL xparmt
Waiting for job...
Finished waiting for job
Job Status : (1)

Status code = 1
myserv:/ps1/psoftts8/Ascential/DataStage/DSEngine: more /tmp/parmout.txt
"1","2",""
"1","2",""
"1","2",""
"1","2",""
"1","2",""
myserv:/ps1/psoftts8/Ascential/DataStage/DSEngine: bin/dsjob -run -mode NORMAL -param MYPARAM=CRAIG -wait -jobstatus INSTALL xparmt
Waiting for job...
Finished waiting for job
Job Status : (1)

Status code = 1
myserv:/ps1/psoftts8/Ascential/DataStage/DSEngine: more /tmp/parmout.txt
"1","2","CRAIG"
"1","2","CRAIG"
"1","2","CRAIG"
"1","2","CRAIG"
"1","2","CRAIG"
myserv:/ps1/psoftts8/Ascential/DataStage/DSEngine:
Flash Gordon
Hyperborean Software Solution
Post Reply