I have a requirement, to get the value of project level userdefined environment variables inside a jobcontrol or routine. I know the easiest way should be declare all the required parameters as job parameters and we can access it inside the job control.
But I dont want it to be defined in the job parameters as the number of parameters is more, and all the parameters wont be required for all the users. So i decided to get it inside the jobcontrol, as the end users wont see it , when running the job.
Is there any way to access the value of the project parameters, inside the jobcontrol?
Get the Value of Project Environment Varaible in Job Control
Moderators: chulett, rschirm, roy
-
- Premium Member
- Posts: 232
- Joined: Fri Aug 04, 2006 1:20 am
- Location: Bangalore
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
-
- Premium Member
- Posts: 232
- Joined: Fri Aug 04, 2006 1:20 am
- Location: Bangalore
Reading DSParams is a good idea, but my boss is suspecting, that this action may corrupt DSParams file.
Is there any thing similar to PX's GetEnvironment for the Server Edition or is there any other way to get it.
I know the environment variable name, and it will be constant , so inside the jobcontrol , i can hardcode like GetEnvironment('$TGT_DB_CONNECTION') and want to read its value.
Is there any thing similar to PX's GetEnvironment for the Server Edition or is there any other way to get it.
I know the environment variable name, and it will be constant , so inside the jobcontrol , i can hardcode like GetEnvironment('$TGT_DB_CONNECTION') and want to read its value.
I'm curious how reading anything would corrupt it?
Roll your own. It would be simple enought to "echo" whatever variable was passed in and return the value associated with it.DS_SUPPORT wrote:Is there any thing similar to PX's GetEnvironment for the Server Edition or is there any other way to get it.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
-
- Premium Member
- Posts: 232
- Joined: Fri Aug 04, 2006 1:20 am
- Location: Bangalore
-
- Premium Member
- Posts: 232
- Joined: Fri Aug 04, 2006 1:20 am
- Location: Bangalore
Thanks for the replies, and i am able to echo the environment variable values.
But I used the function , which is provided by Ray in some other posts.
I used it as a Subroutine in my JobControl.
Thanks for helping.
But I used the function , which is provided by Ray in some other posts.
Code: Select all
FUNCTION GetEnvironmentVariable(EnvVarName)
If UnAssigned(EnvVarName) Or IsNull(EnvVarName)
Then
Ans = @NULL
End
Else
Call DSExecute("UV", "ENV", Output, ExitStatus)
FindStr EnvVarName In Output Setting FMC,VMC,SMC
Then
Ans = Field(Output<FMC,VMC,SMC>, "=", 2, 99)
End
Else
Ans = ""
End
End
RETURN(Ans)
Thanks for helping.