Previous Topic: Define Job Success or FailureNext Topic: Add Comments to a Job


Specify Environment Variables

You can specify environment variables to define the local environment where the script, command, or the batch file runs. You can modify existing environment variables or create your own.

Note: When passing multiple environment variables to an agent, the maximum size allowed is 4 KB.

Follow these steps:

  1. Open the Application in the Define perspective.

    The Application appears in the workspace.

  2. Right-click the job in the workspace, and select Edit from the pop-up menu.

    The Basic page of the job definition dialog opens.

  3. Click Environment Variables in the left pane.

    The Environment Variables page opens in the right pane.

  4. Click Add.

    A new row is added to the Environment variables table.

  5. Complete the following fields as required:
    Name

    Defines the name of a new environment variable or specifies the name of an existing environment variable.

    Note: The agent does not support spaces in environment variable names.

    Value

    Specifies a value for the environment variable.

    Note: If the value contains spaces, commas, quotes, double quotes, equal signs, open brackets, or close brackets, enclose the value in double quotes. To specify a double quote in a value, precede the double quote with another double quote.

  6. (Optional) Repeat the previous two steps to specify additional environment variables.
  7. Click OK.

    The server passes the name and value of each environment variable to the script, command, or batch file when the job runs.

Example: Specify Alternative Input and Output Sources

The following table lists the input and output streams that all UNIX programs run by a shell are connected to:

Stream

Default Source

Environment Variable

Standard input stream

Keyboard

STDIN

Standard output stream

Screen

STDOUT

Standard error output stream

Screen

STDERR

To specify alternative input and output sources

  1. Open the Environment Variables page.
  2. Click Add.

    A new row is added to the Environment variables table.

  3. Enter STDIN in the Name field and the full path of an alternative input stream in the Value field.
  4. Click Add.

    A new row is added to the Environment variables table.

  5. Enter STDOUT in the Name field and the full path of an alternative output stream in the Value field.
  6. Click Add.

    A new row is added to the Environment variables table.

  7. Enter STDERR in the Name field and the full path of an alternative error stream in the Value field.
  8. Click OK.

    The alternative input and output sources are specified.

Example: Specify Environment Variables as Part of the Variable Value

Suppose that the output of a job is written to a file named JOB_OUTPUT located in the path specified by the MY_FILES environment variable.

For this example, enter STDOUT in the Name field and $MY_FILES/JOB_OUTPUT in the Value field.

Example: Set an Environment Variable to an Empty Value

To set an environment variable to an empty value, you can enter two quotes without spaces (““) in the Value field.

Suppose that a job runs a script under the user ID jdoe. The script uses an environment variable named VAR1, which is set in the profile file for jdoe. The server passes VAR1 and its empty value to the script.

For this example, enter VAR1 in the Name field and ““ in the Value field.

Example: Set Environment Variables in a PeopleSoft Job

Suppose that you want to set environment variables in a PeopleSoft job. In this example, the location of the PeopleSoft PeopleTools executables (TOOLBIN) and path to the database drivers (DBBIN) are set.

  1. Open the Environment Variables page of the PeopleSoft job definition.
  2. Click Add and enter the following information in the first row of the table:

    Note: To specify the PeopleSoft home directory (%PS_HOME%), you must escape the percent signs (%) by doubling them. Otherwise, the value is treated as a symbolic variable.

  3. Click Add and enter the following information in the second row of the table:
  4. Click OK.

    The environment variables are specified for the PeopleSoft job.

More information:

Environment Variables in OpenVMS

Environment Variables in Tandem NSK

Environment Variables in Windows

Environment Variables in UNIX