Minnu's Blog on Informatica & Data warehouse concepts

Archives

Monday, June 9, 2008

Parameters in Pre & Post Session CMD's from V8 on

Use parameter file value in a Pre- or Post-session Command task in PowerCenter 8.1.1

Solution
From PowerCenter 8.1.1, parameterized values can be used in Pre/Post-session commands. The syntax for the parameter name should be prefixed with Param_.

Example
$Param_Test
Parameter file: $Param_OutputFile=Test.txt
In Pre_session Command:
The dir c:\doc\values > $Param_OutputFile will be replaced by dir c:\doc\values > Test.txt
Note
The parameter name should begin with $Param . The following error will be displayed if it is not prefixed with $Param :
Warning! Found an unused name and value pair [$Outfile = test.txt]

Applies To
PowerCenter 8.1.1

HOW IT HAPPEN'S IN V6 & 7 IS

Not all session parameters are resolved when used in a pre-session command task

Problem Description
When the session parameters are used in the pre- or post-session command, the parameters are not being resolved.
Example:
The pre-session command used in the session is
cat $InputFileA $InputFileB > $InputFileC
From the session log, the command executed is
cat $InputFileA $InputFileB > /Informatica/SrcFiles/source_file_name.dat
While the server expanded session parameter "$InputFileC", it did not expand the other parameters, "$InputFileA" and"$InputFileB". All of these session parameters are defined in the parameter file.
Solution
Session parameters are not expanded in a pre- or post- session command task when they are not specified in the session.

Applies To
PowerCenter 6.x
PowerCenter 7


More Information
In this example "$InputFileC" is specified in the session properties as the source file parameter, so it is expanded at session runtime. The other two session parameters are not specified in the session properties, so they are not resolve at session runtime.


FAQ: What variables and parameters can be specified in Pre- and Post-Session shell commands?

Answer
The following variables can be used in a Pre- or Post-Session command:
Server variables
Session parameters

PowerCenter Server variables define the path and directories for session and workflow output files and caches. You can also use server variables to define workflow properties, such as the number of workflow logs to archive. The variables can be viewed under the server registration in the Workflow Manager.
Session Parameters
Session parameters are used in the session properties to specify properties such as source file name, etc. To use these in a shell command the session parameters must be set in the parameter file and specified in the session properties.
$PMSessionLogFile
$DBConnection_
$InputFile_
$OutputFile_
$LookupFile_
$BadFile_


More Information
Variable and Parameter Syntax
When variables and parameters are preceded by only one dollar sign ("$") (such as $PMRootDir or $PMSessionLogFile ), they can be used in pre- and post-session shell commands. Variables that are preceded by two dollar signs ("$$"), are user defined (either in a mapping or in a workflow) variables and they cannot be expanded in pre- or post session shell commands.

1 comments:

Anonymous said...

Brokersring.com - Learn how to turn $500 into $5,000 in a month!

[url=http://www.brokersring.com/]Make Money Online[/url] - The Secret Reveled with Binary Option

Binary Options is the way to [url=http://www.brokersring.com/]make money[/url] securely online