Hi,
Can any one please tell me how to access datastage Env variable value in basic routine.
Thanks
Accessing Datastage Env variable value in Basic Rouitne
Moderators: chulett, rschirm, roy
You can use a code snippet similar if you have a job handle attached.
In the example above $TARGET_ENV is a parameter defined as a DS Environment variable.
Code: Select all
CurrentJobHandle = DSJ.ME
/* CurrentJobHandle= DSAttachJob(JobName,DSJ.ERRFATAL)*/
TargetEnv = '$TARGET_ENV'
TargetEnvValue = DSGetParamInfo(CurrentJobHandle, TargetEnv, DSJ.PARAMVALUE)
Ans = TargetEnvValue
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
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)
Last edited by ray.wurlod on Wed Jul 16, 2008 3:58 pm, edited 1 time in total.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
-
- Premium Member
- Posts: 457
- Joined: Tue Sep 25, 2007 4:05 pm
I have a question with this routine Ray.
> Is there a reason why "UnAssigned()" is present twice?
> Is there a reason why "UnAssigned()" is present twice?
Code: Select all
If UnAssigned(EnvVarName) Or UnAssigned(EnvVarName)
Then
Ans = @NULL
Vivek Gadwal
Experience is what you get when you didn't get what you wanted
Experience is what you get when you didn't get what you wanted
Code: Select all
UNIXcmd="echo $yourenvironmentvariable"
CALL DSExecute("UNIX", UNIXcmd, ScreenOutput,ReturnCode)
yourenvironmentvariable = ScreenOutput<1>
Kenneth Bland
Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
The test condition should have been
I have edited the original post to show this.
Code: Select all
UnAssigned(EnvVarName) Or IsNull(EnvVarName)
I have edited the original post to show this.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.