environmental variable in a rountine
Moderators: chulett, rschirm, roy
environmental variable in a rountine
Hi all,
I have set one parameter dirloc in the administrator.
The same parameter in the job is assigned a $projdef.
that is the parameer gets a environmental variable.
Can i assign an environmental variable to varible in routine.
If so can anbody tell me the function and the syntax to be used
I have set one parameter dirloc in the administrator.
The same parameter in the job is assigned a $projdef.
that is the parameer gets a environmental variable.
Can i assign an environmental variable to varible in routine.
If so can anbody tell me the function and the syntax to be used
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
I was asked not to use the job parameter. instead get it from the enviromental varibale.i saw the few discussions from those
For this part i have this the syntax like this
but still i get an error
I was setting it in a sample test routine.to see what output it gets. but i don't get any value
can any body correct me on the code if i have used it wrong
For this part i have this the syntax like this
Code: Select all
Call DSExecute("UNIX","echo $DSLOG_DIR",UnixOutput,SystemReturnCode)
var = UnixOutput
I was setting it in a sample test routine.to see what output it gets. but i don't get any value
can any body correct me on the code if i have used it wrong
Please explain exactly what is 'not working' about it. Simply saying 'it is not working' or 'i get an error' without mentioning the error involved makes it pretty hard to help you.
You might want to post the entire routine. That snippet looks fine, the only 'error' I could see would be the value coming back empty if the variable is not set. Then again, that depends on your Operating System - some echo back an empty value when the variable isn't set while others actually return an error and specifically tell you it isn't set. You should always check the value of the 'SystemReturnCode' variable when using DSExecute in case Something Goes Wrong so you can handle it properly.
![Confused :?](./images/smilies/icon_confused.gif)
You might want to post the entire routine. That snippet looks fine, the only 'error' I could see would be the value coming back empty if the variable is not set. Then again, that depends on your Operating System - some echo back an empty value when the variable isn't set while others actually return an error and specifically tell you it isn't set. You should always check the value of the 'SystemReturnCode' variable when using DSExecute in case Something Goes Wrong so you can handle it properly.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
![Confused :?](./images/smilies/icon_confused.gif)
Your code, minimal as it is, works fine. Your conclusions must be based on testing the routine in the Manager, which is fine as long as you understand what you are seeing. In the Manager, the only environment variables available to you at that moment are those set in your .profile file. Environment variables that only exist in the Administrator (what you refer to as 'from the DSParams file') are only instantiated when a job runs. Outside of a running job, they do not exist.
Build yourself a test Sequence job. Use a single Routine Activity stage to call your routine. Run the job. Check the job's log for the 'Summary of sequence run' entry. Post the results.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact: