Page 1 of 1

can you override a "Add Environment Variable" parm

Posted: Mon Dec 03, 2007 5:33 pm
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

Posted: Mon Dec 03, 2007 5:50 pm
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?

Posted: Mon Dec 03, 2007 7:14 pm
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

Posted: Tue Dec 04, 2007 12:21 am
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.

Posted: Tue Dec 04, 2007 7:45 am
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.

Posted: Wed Dec 05, 2007 1:28 pm
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

Posted: Wed Dec 05, 2007 1:30 pm
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

Posted: Wed Dec 05, 2007 1:32 pm
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

Posted: Wed Dec 05, 2007 1:48 pm
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?

Posted: Wed Dec 05, 2007 3:12 pm
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: