Use the <setenv> element to initialize environment variable values within <interface> or <match> elements. The <setenv> element is an empty element; it does not contain other elements. The following example shows the attributes for a <setenv> element:
<setenv group="Adaptor" name="LAST_VER" value="$LAST_VER>$1?$LAST_VER:$1" eval="true"/>
The optional eval attribute identifies whether the value should be logically evaluated; in the example, the LAST_VER variable will be set to the greater of $LAST_VER or the value in the $1 variable. An additional attribute, type, can be used if you do not use the group attribute.
You can use a variable in the value of the name attribute, so that you can set or create variables whose names are not known in advance.
The element can be used in three different ways:
When you specify a group name, this element works like the .set command: it sets the variable value in the master record in the database, not the copy used by the current step, so the change is not seen by the adaptor algorithm, but takes effect in the first step of the next job (or the next time that the group is copied from the master record, which can happen if a step explicitly references the group). When you specify a group name, you must refer to an existing variable within the specified group; you cannot create a new variable.
<setenv group="MyGroup" name="LAST_RUN" value="$CurDate"/>
<setenv group="[ADAPTOR]" name="MyVar" value="MyVal"When the project runs, Build Forge looks for the environment associated with the adaptor link or the adaptor dot command and uses this environment as the value for the group="[ADAPTOR]" attribute.
<setenv name="NewDriverNeeded" value="Y"/>
<setenv name="Changing" value="Source Changes for this Job:\n" type="temp"/>
You have two other options with temporary variables:
<setenv name="Changes" value="$4 - $1 - $6" type="temp append\n" />
<setenv name="BaseFolder" value="$1" type="temp once"/>
Use the conditional attribute to control whether the <setenv> element initializes or modifies environment variables in <interface> or <match> elements. The value of the conditional attribute is an expression that evaluates to true or false. If the expression evaluates to true, <setenv> initializes or modifies environment variables; otherwise, it does not.