Parameters and variables in Informatica PowerCenter
Purpose
A mapping can utilize parameters and variables to store information during the execution. Each parameter and variable is defined with a specific data type and their main purpose is to provide increased development flexibility.
Parameters are different from variables in the fact that:
Both parameters and variables can be accessed from any component in the mapping which supports it.
To create a parameter or variable, go to Mapping -> Parameters and Variables from within the Mapping Designer in the Designer client.
The format is $$VariableName or $$ParameterName
Changing values of Variables
To change the value of a variable, one of the following functions can be used within an expression: SETMAXVARIABLE($$Variable, value) , SETMINVARIABLE($$Variable, value), SETVARIABLE($$Variable, value) , SETCOUNTVARIABLE($$Variable), where:
At the end of a successful session, the values of variables are saved to the repository. The SetVariable function writes the final value of a variable to the repository based on the Aggregation Type selected when the variable was defined.
Parameter files
Parameter file is an ASCII file which is used to set values of mapping paramteres and variables. Parameters can be set on workflow, worklet or session level. The physical location of a parameter file is set in Workflow manager in Workflows -> Edit. It can also be specified using the pmcmd command when starting a session task.
Parameter file structure
Parameters can be grouped into the following sections:
- [Global]
- [Service: service name]
- [folder name.WF:workflow name]
- [folder name.WF:workflow name.WT:worklet name]
- [folder name.WF:workflow name.WT:worklet name.WT:worklet name...]
- [folder name.WF:workflow name.ST:session name]
- [folder name.session name]
- [session name]
Examples / useful tips
- The value is initialized by the specification that defines it, however it can be set to a different value in a parameter file, specified for the session task
- Initialization priority of Parameters: Parameter file, Declared initial value, Default value
- Initialization priority of Variables: Parameter file, Repository value, Declared initial value, Default value
- Parameters and variables can only be utilized inside of the object that they are created in.
- Parameters and variables can be used in pre and post-SQL
- Sample parameter file:
[Service:IntegrationSvc_01] $$SuccessEmail=dwhadmin@etl-tools.info $$FailureEmail=helpdesk@etl-tools.info [DWH_PROJECT.WF:wkf_daily_loading] $$platform=hpux $$DBC_ORA=oracle_dwh [DWH_PROJECT.WF:wkf_daily_loading.ST:s_src_sa_sapbw] $$DBC_SAP=sapbw.etl-tools.info $$DBC_ORA=oracle_sap_staging