Using a Variable to Reference a File

In a process flow, variables are useful if you want multiple activities in the process flow to reference the same file. Using a variable, can define the file in one place, then reference the variable in all downstream activities that need to reference the file. If the file ever changes, you can modify the variable definition without having to modify all the downstream activities.

When you add a job activity to a process flow, the activity automatically creates variables for each source and sink in the dataflow. If there are files you want to use in the process flow that are not defined in the source or sink of a job, you can create variables.

When you add a Run Program activity, no variables are created by default. If you want to use variables with a Run Program activity you must create them.

This procedure describes how to create a variable in a job activity or a Run Program activity.

  1. Open the process flow in Enterprise Designer.
  2. Double-click the job activity or Run Program activity where you want to define the variable.
    Note: Variables can only be referenced by activities that follow the activity where you define the variable, so be sure to define the variable in an activity that precedes the activities where you want to use the variable.
  3. Click the Variables tab.
  4. Create the variable.
    Option Description

    To create a new variable for an input file...

    Next to Inputs click Add. In the Name field enter a name for the variable. This is the name that downstream activities will reference. In the Location field choose one of the following:

    Use file specified in job
    Choose this option to use the file defined in the source stage in the job. This option is only available if you are defining a variable for a job activity.
    Browse for file on the server
    Choose this option if you want to select a file to assign to this variable.
    Reference an upstream activity's file
    Choose this option if you want to use a file assigned to an existing variable from an upstream stage.
    To create a new variable for an output file...

    Next to Inputs click Add. In the Name field enter a name for the variable. This is the name that downstream activities will reference. In the Location field choose one of the following:

    Browse for file on the server
    Choose this option if you want to select a file to assign to this variable.
    Temporary file managed by the server
    Choose this option if you want this variable to reference a temporary file that will be automatically created and deleted as needed. This option is useful in cases where a file used only as an intermediate step in a process flow and is not needed once the process flow completes.
  5. Click OK to close the Add Variable window.
  6. Click OK to close the activity options window.
  7. To reference the variable in a downstream activity:
    1. Double-click the activity that you want to reference the variable.
    2. Select the input stage that you want to have reference the variable and click Modify.
    3. In the Location field, select Reference an upstream activity's file....