¨ Mapping Parameters and Variables in Sessions, 182
¨ Assigning Parameter and Variable Values in a Session, 182
Working with Session Parameters
Session parameters represent values that can change between session runs, such as database connections or source and target files.
Session parameters are either user-defined or built-in. Use user-defined session parameters in session or workflow properties and define the values in a parameter file. When you run a session, the Integration Service matches parameters in the parameter file with the parameters in the session. It uses the value in the parameter file for the session property value. In the parameter file, folder and session names are case sensitive.
For example, you can write session logs to a log file. In the session properties, use $PMSessionLogFile as the session log file name, and set $PMSessionLogFile to TestRun.txt in the parameter file. When you run the session, the Integration Service creates a session log named TestRun.txt.
User-defined session parameters do not have default values, so you must define them in a parameter file. If the Integration Service cannot find a value for a user-defined session parameter, it fails the session, takes an empty string as the default value, or fails to expand the parameter at run time.
You can run a session with different parameter files when you use pmcmd to start a session. The parameter file you set with pmcmd overrides the parameter file in the session or workflow properties.
Use built-in session parameters to get run-time information such as folder name, service names, or session run statistics. You can use built-in session parameters in post-session shell commands, SQL commands, and email messages. You can also use them in input fields in the Designer and Workflow Manager that accept session parameters. The Integration Service sets the values of built-in session parameters. You cannot define built-in session parameter values in the parameter file. The Integration Service expands these parameters when the session runs.
177
The following table describe the user-defined session parameters:
Parameter Type Naming Convention Description
Session Log File $PMSessionLogFile Defines the name of the session log between session runs.
Number of Partitions $DynamicPartitionCount Defines the number of partitions for a session.
Source File $InputFileName Defines a source file name.
Define the parameter name using the appropriate prefix.
Lookup File $LookupFileName Defines a lookup file name.
Define the parameter name using the appropriate prefix.
Target File $OutputFileNames Defines a target file name.
Define the parameter name using the appropriate prefix.
Reject File $BadFileName Defines a reject file name.
Define the parameter name using the appropriate prefix.
Database Connection $DBConnectionName Defines a relational database connection for a source, target, lookup, or stored procedure.
Name the parameter using the appropriate prefix.
External Loader Connection
$LoaderConnectionName Defines external loader connections.
Define the parameter name using the appropriate prefix.
FTP Connection $FTPConnectionName Defines FTP connections.
Define the parameter name using the appropriate prefix.
Queue Connection $QueueConnectionName Defines database connections for message queues.
Define the parameter name using the appropriate prefix.
Source or Target Application Connection
$AppConnectionName Defines connections to source and target applications.
Define the parameter name using the appropriate prefix.
General Session Parameter
$ParamName Defines any other session property. For example, you can use this parameter to define a table owner name, table name prefix, FTP file or directory name, lookup cache file name prefix, or email address. You can use this parameter to define source, lookup, target, and reject file names, but not the session log file name or database connections.
Define the parameter name using the appropriate prefix.
The following table describes the built-in session parameters:
Parameter Type Naming Convention Description
Folder name $PMFolderName Returns the folder name.
Integration Service name
$PMIntegrationServiceName Returns the Integration Service name.
Mapping name $PMMappingName Returns the mapping name.
Repository Service name
$PMRepositoryServiceName Returns the Repository Service name.
178 Chapter 15: Parameters and Variables in Sessions
Parameter Type Naming Convention Description Repository user
name
$PMRepositoryUserName Returns the repository user name.
Session name $PMSessionName Returns the session name.
Session run mode $PMSessionRunMode Returns the session run mode (normal or recovery).
Source number of affected rows
$PMSourceQualifierName@numAffectedRows Returns the number of rows the Integration Service successfully read from the named
$PMSourceQualifierName@numAppliedRows Returns the number of rows the Integration Service successfully read from the named
$PMSourceQualifierName@numRejectedRows Returns the number of rows the Integration Service dropped when reading from the named Source Qualifier.
Define the parameter name using the appropriate prefix and suffix.
Source table name $PMSourceName@TableName Returns the table name for the named source instance.
Define the parameter name using the appropriate prefix and suffix.
Target number of affected rows
$PMTargetName@numAffectedRows Returns the number of rows affected by the specified operation for the named target
$PMTargetName@numAppliedRows Returns the number of rows the Integration Service successfully applied to the named
$PMTargetName@numRejectedRows Returns the number of rows the Integration Service rejected when writing to the named target instance.
Define the parameter name using the appropriate prefix and suffix.
Target table name $PMTargetName@TableName Returns the table name for the named target instance.
Define the parameter name using the appropriate prefix and suffix.
Workflow name $PMWorkflowName Returns the workflow name.
Working with Session Parameters 179
Parameter Type Naming Convention Description
Workflow run ID $PMWorkflowRunId Returns the workflow run ID.
Workflow run instance name
$PMWorkflowRunInstanceName Returns the workflow run instance name.
Define parameter names using the appropriate prefix and suffix. For example, for a source instance named
“Customers,” the parameter for source table name is $PMCustomers@TableName. If the Source Qualifier is named “SQ_Customers,” the parameter for source number of affected rows is
$PMSQ_Customers@numAffectedRows.