You are here: Administration Riser Bar>Using Macro Variables>Introduction to Macro Variables

DataFlux Data Management Studio 2.6: User Guide

Introduction to Macro Variables

Overview

Macro variables enable you to dynamically substitute text strings in data jobs, process jobs, profiles, and business rules through symbolic substitution. You can assign large or small amounts of text to macro variables. The macro variable is replaced at run-time with the value that is defined in the macro definition.

A macro variable definition is a name-value pair that defines the text that will be substituted for the name at run-time. For example, a macro variable named INPUT_DIR_PATH could have the following definition:

INPUT_DIR_PATH=c:\MyFolder

All characters after the equal sign (=) and before the new line character become part of the definition. This means, for example, that you should not use spaces, quotation marks, or other characters after the equal sign unless you want them to be part of the text that is retrieved when the macro variable is called. The equal sign (=) and the new line character are reserved characters, but otherwise there are no restrictions on which characters can be used in a macro variable definition. There are no practical limits on the length of a macro variable name.

If you establish naming conventions for user-defined macro variables at your site, it will be easier to understand and manage these variables. For example, naming conventions can help you avoid accidental collisions with DataFlux Data Management Studio configuration directives, some of which have common names, such as checkpoint. If you were to define a macro variable called checkpoint, it could override the default for this directive, and that might not be what you want. For a description of the configuration directives, see "Configuration Options" in the DataFlux Data Management Studio Installation and Configuration Guide.

The name in the definition (such as INPUT_DIR_PATH) is the string that you reference in a macro call. The syntax for a macro call is the macro name enclosed in two percentage marks, such as the following:

%%INPUT_DIR_PATH%%

See also Usage Notes for Macro Variables.

How Macros Variables Are Used

Macro variables can be used in data jobs, process jobs, profiles, and business rules. They are often used instead of literal path names to help make jobs and other objects portable across environments. They can be used to change a job's output without updating the job. For example, you might need to have a weekly job originate from a different input file for every run. You can vary the input file by specifying it with a macro instead of updating the hard-coded file path in the job. For an example, see Using Macro Variables to Specify File Names.

Macro variables can be dynamically retrieved and set in an expression. For an example, see Using a Macro In an Expression.

Macro variable syntax can be used to pass parameters between a Data Job node and the process job that contains it. For an example, see the Set Up the Data Job Node section in the "Creating a Process Job" topic. Macro variables can be used to pass information into and out of a process job, as described in Deploying a Process Job as a Real-Time Service.

Macro variables can be used to change system configuration values for DataFlux Data Management Studio. This is done by specifying the appropriate directive, such as BASE/MACROS_PATH, in a macro variable definition. The name of the macro would be the same as the directive, and the value would be the new setting for that directive. For a description of the configuration directives, see "Configuration Options" in the DataFlux Data Management Studio Installation and Configuration Guide.

Documentation Feedback: yourturn@sas.com
Note: Always include the Doc ID when providing documentation feedback.

Doc ID: dfU_T_Macros_Over.html