Thursday, May 23, 2019

Session parameters & Session variables

Session Parameter :-
----------------------
Session parameters, like mapping parameters, represent values you might want to change between sessions, such as a database connection or source file. 

Use session parameters in the session properties, and then define the parameters in a parameter file. 

You can specify the parameter file for the session to use in the session properties. 

You can also specify it when you use pmcmd to start the session.The Workflow Manager provides one built-in session parameter, $PMSessionLogFile.With $PMSessionLogFile, you can change the name of the session log generated for the session.

The Workflow Manager also allows you to create user-defined session parameters.


Naming Conventions for User-Defined Session Parameters :

Parameter Type           Parameter Connection
------------------           ------------------------
Database Connection    $DBconnectionName
Source File                  $InputFileName
TargetFile                   $OutputFileName
Lookup File                 $LookupFileName
Reject File                  $BadFileName


Lets create a Mapping with session parameters for Oracle DB and execute it.

- Create any mapping and a workflow
- Double click the session, edit the connection 'source_system' and create a          parameter connect as in the image.



- Create a parameter file as in the image
- First we give the folder name, next we give session name followed by the session parameter and its connection without spaces in between.




- Give the parameter file location along with name in the session properties.


  
- Now execute the workflow.


Lets create a Mapping with session parameters for Flat files and execute it.

- Create any mapping and a workflow
- Double click the session and give the source name as $InputFile.



- Create a parameter file as in the image
- First we give the folder name, next we give session name followed by the session parameter and Flat File location.


Now execute the workflow.


Scenario 2 :-
-------------
Use session parameters to make sessions more flexible. 
For example, you have the same type of transactional data written to two different databases, and you use the database connections TransDB1 and TransDB2 to connect to the databases. 

You want to use the same mapping for both tables. Instead of creating two sessions for the same mapping, you can create a database connection parameter, $DBConnectionSource, and use it as the source database connection for the session. 

When you create a parameter file for the session, you set $DBConnectionSource to TransDB1 and run the session. After the session completes, you set $DBConnectionSource to TransDB2 and run the session again. 

You might use several session parameters together to make session management easier. For example, you might use source file and database connection parameters to configure a session to read data from different source files and write the results to different target databases. You can then use reject file parameters to write the session reject files to the target machine. You can use the session log parameter, $PMSessionLogFile, to write to different session logs in the target machine, as well. 

When you use session parameters, you must define the parameters in the parameter file. Session parameters do not have default values. When the PowerCenter Server cannot find a value for a session parameter, it fails to initialize the session.


Session Variables :-
---------------------


No comments:

Post a Comment

SUBQUERIES PRACTISE QUESTIONS

1. Write a SQL query to find those employees who receive a higher salary than the employee with ID 7369. SELECT * FROM EMP WHERE SAL >  (...