Sunteți pe pagina 1din 7

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:

The value of a parameter is fixed during the run of the mapping Variables can change in value during run-time 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:

SETVARIABLE sets the variable to a value that you specify (executes only if a row is marked as insert or update). At the end of a successful session, the Integration Service saves either the MAX or MIN of (start value.final value) to the repository, depending on the aggregate type of the variable. Unless overridden, it uses the saved value as the start value of the variable for the next session run. SETCOUNTVARIABLE - increments a counter variable. If the Row Type is Insert increment +1, if Row Type is Delete increment -1. A value = 0 is used for Update and Reject. SETMAXVARIABLE - compare current value to value passed into the function. Returns the higher value and sets the current value to the higher value. SETMINVARIABLE - compare current value to the value passed into the function. Returns the lower value and sets the current value to the lower value.
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

Informatica Parameter Files


by Priya T on August 23, 2011 in Informatica Way

Get the latest updates on Informatica Way directly in your inbox. Subscribe now Parameter file is a text file that contains parameters and variables which can be referenced in Sessions and Workflows. Multiple Session and Workflows can share the same parameter file by logically grouping the Parameter file as mentioned below. Each section is preceded by a heading that identifies the Integration Service, Integration Service process, Workflow, Worklet or session to which the parameters or variables need to be defined. Parameters and variables need to be defined below the heading. Characteristics:

The Integration Service interprets all characters between the beginning of the line and the first equals sign

as the parameter name and all characters between the first equals sign and the end of the line as the parameter value. Parameter File Sections: The following table describes the parameter file headings that define each section in the parameter file and the scope of the parameters and variables that you define in each section. We can define the parameters in the file as shown below:

Heading

Example

Scope

[Global]

$PMSuccessEmailUser=pcadmin@mail.co m $PMFailureEmailUser=pcadmin@mail.co m

All Integration Services, Integration Service processes, workflows, worklets, and sessions. The named Integration Service and workflows, worklets, and sessions that this service runs.

[Service:service name]

[Service:ETLI] $PMSuccessEmailUser=pcadmin@mail.co m $PMFailureEmailUser=pcadmin@mail.co m

[Service:service name.ND:node name]

[Service:ETLI.ND:node1] $PMSuccessEmailUser=pcadmin@mail.co m $PMFailureEmailUser=pcadmin@mail.co m

The named Integration Service process and workflows, worklets, and sessions that this service process runs.

[folder name.WF:workflow name]

[SCN_D.WF:w_test] $PMSuccessEmailUser=pcadmin@mail.co m $PMFailureEmailUser=pcadmin@mail.co m

The named workflow and all sessions within the workflow.

[folder name.WF:workflow name.WT:worklet name]

[SCN_D.WF:w_test.WT:wrk_sub_test] $PMSuccessEmailUser=pcadmin@mail.co m $PMFailureEmailUser=pcadmin@mail.co m

The named worklet and all sessions within the worklet.

[folder name.WF:workflow name.WT:worklet name.WT:worklet name...]

[SCN_D.WF:w_test.WT:wrk_sub_test. WT:wrk_sub_test1] $PMSuccessEmailUser=pcadmin@mail.co m $PMFailureEmailUser=pcadmin@mail.co m

The nested worklet and all sessions within the nested worklet.

[folder name.WF:workflow name.ST:session name]

[SCN_D.WF:w_test.ST:s_test] $PMSuccessEmailUser=pcadmin@mail.co m $PMFailureEmailUser=pcadmin@mail.co

The named session.

-or[folder name.WF:workflow name.WT:worklet name.ST:session name]

m or [SCN_D.WF:w_test.WT:wrk_sub_test. ST:s_test] $PMSuccessEmailUser=pcadmin@mail.co

-or[folder name.session name]

m $PMFailureEmailUser=pcadmin@mail.co m Or

-or[SCN_D.ST:s_test] [session name] $PMSuccessEmailUser=pcadmin@mail.co m $PMFailureEmailUser=pcadmin@mail.co m Or [s_test] $PMSuccessEmailUser=pcadmin@mail.co m $PMFailureEmailUser=pcadmin@mail.co m

Precedence: Create each heading only once in the parameter file. If there are multiple headers with the same name, Integration service will always refer to the first one and ignore the rest. For example, a parameter file contains the following identical headings:[HET_TGTS.WF:wf_TCOMMIT1] $$platform=windows

[HET_TGTS.WF:wf_TCOMMIT1] $$platform=unix $DBConnection_ora=Ora2 In workflow wf_TCOMMIT1, the value for mapping parameter $$platform will be windows and not unix. Also, session parameter $DBConnection_ora is not defined. If we define the same parameter or variable in multiple sections in the parameter file, the parameter or variable with the smallest scope takes precedence over parameters or variables with larger scope. For example, a parameter file contains the following sections:[HET_TGTS.WF:wf_TGTS_ASC_ORDR] $DBConnection_ora=Ora2[HET_TGTS.WF:wf_TGTS_ASC_ORDR.ST:s_TGTS_ASC_ORDR] $DBConnection_ora=Ora3 In session s_TGTS_ASC_ORDR, the value for session parameter $DBConnection_ora is Ora3. In all other sessions in the workflow, it is Ora2. Comments: Comments can be defined on parameter files. The Integration Service ignores lines that are not valid headings and do not contain an equals sign character (=). The following lines are examples of parameter file comments: Created 10/11/06 by Smith. *** Update the parameters below this line when you run this workflow on Integration Service Int_01. *** ; This is a valid comment because this line contains no equals sign.

S-ar putea să vă placă și