IBM Support

Defining environment variables to be used with Rhapsody

Question & Answer


Question

How do you define the environment variables to be used with IBM Rational Rhapsody?

Answer

The EnvironmentVariables property (under General::Model) enables you to specify environment variables for Rhapsody to execute when your project is opened. You can use environment variables to specify various file paths in your project. For example, you could use environment variables to specify the location of legacy source files or the location of referenced units. This capability provides the benefit of storing your model and environment in one location (the Rhapsody project) so you can easily share and distribute complex projects.

Rhapsody parses the content of the EnvironmentVariables property and executes the specified environment variables. This execution occurs when a project is opened and after all project-level properties are applied, but before any additional units (packages, components, and diagrams) are read. "Execution" means iterating over the lines and setting the environment variable through the operating system API -- there will be no "source." When you open a project and all the properties overridden at the project level are applied (but before any additional units are read),

Rhapsody parses the contents of this property and sets the relevant environment variables. This setting affects every place Rhapsody looks for an environment variable, which means that it affects the logical path.

Note: You can override this property only at the site.prp or project level. For example, consider the case where you include legacy files in your project, and use the variable LEGACY_DIR in your makefile to specify the location of those files. If you set the EnvironmentVariables property to include the path for LEGACY_DIR, Rhapsody executes the variable when the model is opened so the make utility can expand the LEGACY_DIR variable. In essence, your "environment" is contained in the Rhapsody model.

As another example, consider the case where you have reference units in your model (added using the option Add to Model As Reference). You can edit the location of a reference unit using the Directory field of the Unit Information dialog box, and use an environment variable as part of that location. If you set the EnvironmentVariables property to include the path of this environment variable, Rhapsody will parse and execute that environment variable when it opens the project, and then search for the reference unit in the specified location. The value of this property is a MultiLine in the following format (with one variable definition per line):

For example, "GENESIS=A:\\".

Note the following restrictions and limitations:

  • Comments are not supported.
  • There is no way to "unset" the variables, other than exiting Rhapsody.
  • Changes in the property setting will take place the next time the project is loaded.
  • If you check out a different version of the .rpy file, the environment variables are reset (they are not "unset" first).
  • If you read another project where this property is overridden in the project context, that setting will execute on top of the previous settings (the settings are not "unset" first).
  • Environment variables defined in "included" property (.prp) files are not supported.
  • The value of the EnvironmentVariables property cannot be based on the value of the same property at a higher level. That is, subsequent definitions of the property cannot be based upon the previous definition. Therefore, you cannot define a $BLK_VAR in the site.prp file and then have a new variable $APP_VAR defined in the project (.rpy) file with a value of $BLK_VAR\SubDir, where the $BLK_VAR value is used from the site.prp file EnvironmentVariables definition. (default = empty MultiLine)

Note: If the environment variables are not set within the Rhapsody model then Rhapsody will use the variables set by the OS.

[{"Product":{"code":"SSB2MU","label":"IBM Engineering Systems Design Rhapsody"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Component":"General Information","Platform":[{"code":"PF016","label":"Linux"},{"code":"PF033","label":"Windows"}],"Version":"7.6.1.1;7.6.1.2;7.6.1.3;7.6.1.4;7.6.1.5;8.0;8.0.1;8.0.2;8.0.3;8.0.4;8.0.5;8.0.6;8.1;8.1.1","Edition":"Rational Rhapsody Architect for Software;Rational Rhapsody Architect for Systems Engineers;Rational Rhapsody Designer for Systems Engineers;Rational Rhapsody Developer","Line of Business":{"code":"LOB59","label":"Sustainability Software"}}]

Historical Number

10231

Product Synonym

Rational Rhapsody

Document Information

Modified date:
27 May 2022

UID

swg21323559