Hi,
i know this post is old but i can't find any other thread about this subject.
I'm a beginer in DataStage, and i try to build a script in SHELL for the exploitation of DataStage.
But i have a issue with the environment variables file. (.env)
I don't know the command line to import this file.
I saw the "dsadmin.sh" and the options that i can use like "-envadd" or "-envset", but it doesn't seem to be what i need.
So here my question :
Do you know how to import the environment file (.env) in UNIX command line please ?
PS : Sorry for my bad english
Administrator interface updates via command line
Moderators: chulett, rschirm, roy
Your English is quite okay.
We use a command line via a scheduler job (Control-M), and the script we use is dependent on a project ssi file that contains the environment variables and their values. To add our update, we modify the ssi file and run the script.
Sample command lines:
The script sets the variables you see, and you'll need a skilled script writer to translate that to your needs. The variables which begin with "G_DS" are the ones included in the ssi file.
The .env file is only for manual user use via the Administrator interface. You could write a script to use it, but it would be less complicated to build it yourself.
We use a command line via a scheduler job (Control-M), and the script we use is dependent on a project ssi file that contains the environment variables and their values. To add our update, we modify the ssi file and run the script.
Sample command lines:
Code: Select all
${DSHOME}/bin/dsadmin ${G_DS_ADMIN_CLI_ARGS} -envadd ${VARNAME} -type STRING -prompt "Env var ${VARNAME}" ${G_DS_PROJ_NAME}
${DSHOME}/bin/dsadmin ${G_DS_ADMIN_CLI_ARGS} -envset ${VARNAME} -value "${VARVALUE}" ${G_DS_PROJ_NAME}
The .env file is only for manual user use via the Administrator interface. You could write a script to use it, but it would be less complicated to build it yourself.
Franklin Evans
"Shared pain is lessened, shared joy increased. Thus do we refute entropy." -- Spider Robinson
Using mainframe data FAQ: viewtopic.php?t=143596 Using CFF FAQ: viewtopic.php?t=157872
"Shared pain is lessened, shared joy increased. Thus do we refute entropy." -- Spider Robinson
Using mainframe data FAQ: viewtopic.php?t=143596 Using CFF FAQ: viewtopic.php?t=157872
Re: Import environment file in a script
That's when you start a new post... and link back to the other one if it's related. I've done that for you but they're not really the same issue. But no worries, we're here now.Namtar78 wrote:i can't find any other thread about this subject.
We would typically just "source" the environment file in the script to bring all of the values into the session / process space the script is running in. Depending on your shell there's an actual source command or the "dot" (a period) is a synonym for it. Depending on the position of that file to the current working directory, you could:
Code: Select all
. .env
-or-
. ./.env
-or-
. /full/pathname/.env
-or-
replace the first "." in any line above with "source"
Conversations online for this can be found by searching for dot space dot slash - literally those four words.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
Re: Import environment file in a script
Thank you both for your answers
FranklinE: If i understand correctly, you compare the variables you have in your project with the file that you received to find the new variables to add or to update ?
chulett: I'm quite interest with that solution (more simple ) but how do you set your project ?
When i have to uprading or creating a project, my developers send me a package with a environment variables file that i have to add in the project and him only.
So if i just have to "source" the file, great :D ... but how can i source him in my project
With the Administrator interface, i can import the file with no worries, he do the compare himself and add or update the variables.
My point is to to do the same thing that the Administrator interface, but in command line. I can't beleive that the only solution is to compare manualy and then add the variables one by one.
or maybe i expect to much... i'm a lazy guy, that why
FranklinE: If i understand correctly, you compare the variables you have in your project with the file that you received to find the new variables to add or to update ?
chulett: I'm quite interest with that solution (more simple ) but how do you set your project ?
When i have to uprading or creating a project, my developers send me a package with a environment variables file that i have to add in the project and him only.
So if i just have to "source" the file, great :D ... but how can i source him in my project
With the Administrator interface, i can import the file with no worries, he do the compare himself and add or update the variables.
My point is to to do the same thing that the Administrator interface, but in command line. I can't beleive that the only solution is to compare manualy and then add the variables one by one.
or maybe i expect to much... i'm a lazy guy, that why
Thank you for clarifying your requirements. My answer was meant to be very generic educational information - shell scripts and environment variables - with nothing related to use of the Administrator interface or projects or anything else 'DataStage exploitation' specific. Thought it might come in handy for you... someday.
Franklin has the specifics you need for this task. I should go back and fix the subject I decided to use for your post. Also, in case it matters, can you confirm what version of the product you are on? I11.x? had to guess.
Franklin has the specifics you need for this task. I should go back and fix the subject I decided to use for your post. Also, in case it matters, can you confirm what version of the product you are on? I11.x? had to guess.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
The code I posted is out of the context of the script we use. Unfortunately, I can't post the rest because it's proprietary and not my place to share it.
I've not looked at the IBM documentation of the admin functions in too long, about 1,000 cyber years ago when we were using 7.x. If one of the functions is to read the current variables and their values first, you could use that, but my experience with importing via Administrator is that the wizard will update if the variable is found and the value is different, and will skip if the value has not changed.
Using a ssi file or similar sourced file as your baseline for the variables gives you basic version control. Use it for the initial import, and use it to make changes. If you have effective version control on the file, you should be confident that your environment variables are accurate.
I've not looked at the IBM documentation of the admin functions in too long, about 1,000 cyber years ago when we were using 7.x. If one of the functions is to read the current variables and their values first, you could use that, but my experience with importing via Administrator is that the wizard will update if the variable is found and the value is different, and will skip if the value has not changed.
Using a ssi file or similar sourced file as your baseline for the variables gives you basic version control. Use it for the initial import, and use it to make changes. If you have effective version control on the file, you should be confident that your environment variables are accurate.
Franklin Evans
"Shared pain is lessened, shared joy increased. Thus do we refute entropy." -- Spider Robinson
Using mainframe data FAQ: viewtopic.php?t=143596 Using CFF FAQ: viewtopic.php?t=157872
"Shared pain is lessened, shared joy increased. Thus do we refute entropy." -- Spider Robinson
Using mainframe data FAQ: viewtopic.php?t=143596 Using CFF FAQ: viewtopic.php?t=157872