Skip to main content

Data & Intelligence

Informatica: Use session parameters in session command

A variable defined in a parameter file cannot be used in a post-session command alone. It must be used along with other session properties like Output file directory or Source file directory for it to be used in the post-session command.

Example

Consider a variable $OutputFileRepSybase that is defined as /home/test in the parameter file.

If this variable is used in a post-session command alone, as in the case of rm $OutputFileRepSybase/f1.txt, the variable will not be expanded and consequently it will fail. However, if the variable is used in Output file directory and then in the post-session command, it works fine.

Solution

We needs to create workflow variables (Workflow->Edit->Variables) with their corresponding names mentioned in parameter file. Then use them as $$Variablename.

Data Intelligence - The Future of Big Data
The Future of Big Data

With some guidance, you can craft a data platform that is right for your organization’s needs and gets the most return from your data capital.

Get the Guide

For example we define 4 variables in parameter file:

$$SERVERNAME=H2800-0016

$$DATABASENAME=AdventureWorks

$$USERNAME=Test

$$PASSWORD=!TEST!

Firstly we create corresponding workflow variables, and then we can use them in Post-Session Failure Command like this:

Osql -S $$SERVERNAME -d $$DATABASENAME -U $$USERNAME -P $$PASSWORD -Q”EXEC insert_test” -b >> c:\myscript.log 2>&1

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.