Managing environment variables in DataStage
You can manage environment variables for IBM® DataStage® in several different ways.
In DataStage, you can manage environment variables in three different ways: at the project level, and the flow level, and by using the dsjob command-line interface (CLI).
Project level
To set up environment variables from the project level, complete the following steps:
- Open a project, then click the Manage tab.
- Click New environment variable + and adding a key-value pair. or edit an existing template by opening it, clicking
- Specify the environment details and configuration.
- In the Environment variables field, specify runtime environment variables
by using a name=value pair.For example:
CC_MSG_LEVEL=1 APT_CONFIG_FILE=/ds-storage/2nodes.apt
- Click Create.
- From a DataStage flow, click the Settings icon on the toolbar, then click Run on the Settings page.
- Select the environment that you created, then click Save.
DataStage flow level
To select environment variables from the flow level, complete the following steps:
- Open a DataStage flow.
- Click the Add parameters icon ({#}) on the toolbar.
- Select one or more environment variables from the list of available environment variables.
- Click Add, then click Return to canvas.
Command-line interface (CLI)
You can pass in environment variables from the CLI. See the following
example:
cpdctl dsjob run --job "TestSimpleJavaWriteJSON.DataStage job" --project Project2021 --wait 300 --param FILE_NAME=/ds-storage/output/MySales5k.json --env "\$CC_MSG_LEVEL"="1"
For more information, see DataStage command-line tools.
Override rules
The following override rules apply to the environment variables:
dsjob
CLI environment variables overwrite DataStage flow level environment variables.- DataStage flow-level environment variables overwrite runtime environment-level environment variables.