Page 1 of 1

Getting values of User defined environment variables in UNIX

Posted: Mon Jan 07, 2008 6:19 pm
by Madhavan VM
Hello All,

My requirement is:

To get the value of User defined environment variable for a project in the UNIX box.

For e.g.:
1. I have defined a variable Log_Dir having value /user/spool/myproject/logdir in the administrator.
2. I am using this variable in the job and have given the value in job as $PROJDEF.
3. I want to run the job from UNIX using dsjob command. I want to use the value "/user/spool/myproject/logdir" in my batch run script.

I could see that if we use the command below it will give me "$PROJDEF":

dsjob -paraminfo project_name job_name parameter_name

Is there a way I can get the actual value (/user/spool/myproject/logdir) stored in administrator?

Your help is appreciated.

Thanks and Regards,
Ajith GK

Posted: Mon Jan 07, 2008 6:52 pm
by chulett
If you want the project default value when the job runs, don't mention the parameter name when you run the job from UNIX. Let it take the default.

Posted: Mon Jan 07, 2008 8:50 pm
by ray.wurlod
If you want to replace the default when running the job, use the -param option.
dsjob -run -param Log_Dir=/user/spool/myproject/logdir projname jobname

To recover the value that was used, whether it was substituted for $PROJDEF or in the run request, you need to look at the job log. The "job started" entry shows the parameter values that were actually used for the run.

Posted: Tue Jan 08, 2008 10:29 am
by Madhavan VM
Hello All,

Thank you for all the replies.

I think my requirement was not mentioned/understood clearly. Let me restate it.

1. I have defined a variable Log_Dir having value /user/spool/myproject/logdir in the administrator.
2. I am creating a script which is different from the one used to run the job from UNIX.

Say, the script is:

SCRIPT_NAME=`basename $0`
JobName=$1

LOG_DIR= :?:
Here I want to assign the value that is there in the administrator.

In short, I want to obtain the actual value defined in the administrator using a combination of Orchestrate and UNIX commands.

Hence, the reason I mentioned that "dsjob -paraminfo project_name job_name parameter_name" will give me the value "$PROJDEF". What I want is "user/spool/myproject/logdir" assigned to the LOG_DIR variable in the UNIX script.

Let me know if you could help me in the same.

Posted: Tue Jan 08, 2008 10:55 am
by maheshsada
to read the value defined in administrator - you have to go to your project in unix and there will be a file - DSParams. If you read the file for your parameter name you can get the value defined in administrator

Posted: Tue Jan 08, 2008 3:26 pm
by Madhavan VM
Thank you Mahesh! That did the trick.

Thanks everyone who responded to the question. :)