Professional Documents
Culture Documents
Explanation :
In this Mapping we will see how to find the number of success , rejected and bad records in
one mapping.
Source file is a flat file which is in .csv format . Click here to download the source
file.The table appears like as shown below..
SE COUN
EMPNO NAME HIREDATE
X T
100 RAJ INVALID DATE M 1
102 MAON INVALID DATE M 2
103 NULL 22-APR-08 M 3
106 NULL NULL M 4
VALID RECORDS ::
In this we will have the valid records.But here we dont want the Employee ,who is 'F'
(Female).So our goal is to load MALE employee info., into the SUCCESS_RECORDS
target table.
For this we need to use a Router transformation and declare the user group as follows \
IIF( sex='M',TRUE,FALSE)
And the defined group will capture teh rejected records which are nothing but
employee who is FEMALE .
This data passed to the REUSABLE Expressiona transformation.Where the
Increamental logic is applied to get the count value for the the no., of success and
rejected records which are passing it.And loaded into the target table.
Look at the below tables :::
SUCCESS_RECORDS::
SE COUN
EMPNO NAME HIREDATE
X T
101 JOHN 22-APR-08 M 1
REJECTED_RECORDS::
We will go for incremental loading to speed up the data loading and reduce
data actually loaded.
There are different ways we can implement this incremantal loads.
One of the those methods by writing SQL Override in SQL using Mapping
variable.
In general , when you take source as flatfile or relational , we find few feilds with NULL
values .If you think that in your business process this null data is a invalid data.Then its
necessary to filter invalid data.The below table shows ::
NAME AGE
JOHN 23
SMITH
34
LUCKY 24
In the above table their are 4 records but in that two are valid and other two are invalid
records because in the 2 nd record AGE value is NULL and in the 3rd record the NAME
is a NULL value .So it is essential to filter 2nd and 3rd before loading into the target
table.The belove table shows how a target table appears witha valid data
NAME AGE
JOHN 23
LUCKY 24
The 2nd and 3rd records can be filtered by using IS_NULL ( ) functionThis is declared
Filter Transformation Condition.
The function appears like this IIF(NOT ISNULL(NAME) ,TRUE,FALSE)
FIlter transformation passes only TRUE records to the target and drops the FALSE
records which are nothing but NULL value records.
When you take a source as Flatfile , their are chances to see the invalid
DATE format .Like as shown in the below source table.
DATE
20-Apr
11-Mar-2008
12-Feb-2008
Feb-2008
If you look at 1 st and 4th record of above table .It clearly shows that the
DATE value format is not correct.In the 1st record year is missing and in
the 4th date is missing.In this case it is necessary to see this invalid data to
be removed before it loaded into the target .Like as shown in below target
table:
DATE
11-Mar-2008
12-Feb-2008
The above can be acheived by using the IS_DATE( ) function .This
is declared in Filter Transformation condition.
The function appears like this IIF(IS_DATE(DATE, 'DD-MON-
YY'),TRUE,FALSE)
Mapping : How to correct the data values without spaces?
Explanation :
In this mapping we will understand how to remove the spaces in the data .It
is very important to see the data values must be aligned equally their should
not be any spaces .
When you take a source as Flatfile and it consists one of the feild as NAME .The following below table is the source table
data::
NAME
Ravi
Ramesh
Swathi
Jack
In the above table you can clearly see the Name values are not aligned properly and to align the data into equally .We
have to use TRIM concept .Now in our mapping we are loading above data into target table .But in target table it appears
like as shown below
NAME
Ravi
Ramesh
Swathi
Jack
The above can be acheived by using the LTRIM( ) function in expression editor.This is declared in Expression
transformation output port.
Mapping : How to convert flatfile Date datatype ( string) into Relational Date
datatype (Date) ?
Explanation :
When you take a source as Flatfile and it consists one of the feild as DATE and its datatype generally a String .The
following below table is the source table ::
DATE String
If you want to load the above source data into realtional target.Then it is manditory to match the datatype.In relational
generaly the date datatype is Date.The following below table is the target table ::
DATE Date
To match the datatype of ports , we use the TO_DATE ( ) function in expression transformation editor.The function appears
like this TO_DATE(DATE,'DD-MON-YY')
Mapping : Design a mapping to validate the records which are extrated from a flatfile.
Solution :
Source : Flatfile
Target : Relational
Informatica version 7.1.1
Database : Oracle
Syntax
Example
Syntax
Mapping : Design a mapping to load the valid source records into warehouse.
Solution :
Source : Flatfile
Target : Relational
Informatica version 7.1.1
Database : Oracle
Mapping : Design a mapping to load the valid source records into warehouse. Solution :
Source : Flatfile
Target : Relational
Informatica version 7.1.1
Database : Oracle
Design a mapping , which generates sequence of numbers using setvariable function in exp
transformation( without using sequence generator)
Mapping Design a mapping as shown below
Mapping : Design a mapping to load the valid source records into warehouse. Solution :
Source : Flatfile
Target : Relational
Informatica version 7.1.1
Database : Oracle
Mapping : Design a mapping generates sequence of numbers without using sequence generator?
Solution :
Source : Flatfile
Target : Relational
Database : Oracle
Note : usage of setmaxvariable() function and mapping variables !
Mapping : first half to one target and second half to other target.
Solution :
Source : Flatfile
Target : Relational
Database : Oracle
Tip : use stored procedure to count the records
Transformations
Pre-SQL: power center server(PCS) executes pre-sql before it reads the source
data
Post-SQL: PCS executes post-sql quey after data return to the target
Work Directory
You must specify a work directory the PowerCenter Server uses to create temporary files
while it sorts data
Distinct Output Rows
It gives distinct output rows .It discards all the duplicate rows .
Null Treated Low
Enable this property if you want the PowerCenter Server to treat null values as lower than
any other value when it performs the sort operation
Reusable ::
Sequnce generator can be made as reusable.
Sequence generator must be reusable , when you pass multiple load into single target .It
is necessary to avoid duplicate sequence values.
If you use different sequence generators , it will generate duplicate values .
Properties ::
If you select Cycle, the PowerCenter Server cycles back to this value when it
Start Value
reaches the end value. The default value is 0.
End Value The maximum value the PowerCenter Server generates
Current Value First value of sequence
Cycle PCS cycles the sequence range after it reaches the end value.
Number of Cached The number of sequence values the PCS cache at a time .Use this option
Values when multiple sessions use the same reusable sequence generator .
Check this option to generate the value from current , when you run the
Reset session for next time .If not it generates from last generated value in the last
session.
Case-Sensitive String Comparison ::
If the session sort order is case-sensitive, select this option to enable case-sensitive string
comparisons, and clear this option to have the PowerCenter Server ignore case for
strings. If the sort order is not case-sensitive, the PowerCenter Server ignores this setting.
By default, this option is selected.
** Note ::If you dont check the option case sensitive string :: first preference goes to lower case
and vice versa.
CACHE ::
Data cache size for the transformation. Default is 2,000,000 bytes.
Index cache size for the transformation . Default is 1,000,000 bytes.
If the total configured session cache size is 2 GB (2,147,483,648 bytes) or more, you
must run the session on a 64-bit PowerCenter Server.
Rank Index ::
The Designer automatically creates a RANKINDEX port for each Rank transformation. The
PowerCenter Server uses the Rank Index port to store the ranking position for each row in a
group
Note:: The Source Qualifier transformation only lets you filter rows from relational sources
Important ::
Case sensitivity. The filter condition is case-sensitive
Appended spaces .Use the LTRIM or RTRIM function to remove additional spaces.
Condition Examples::
SAL >3000
IFF(ISNULL(NAME),FALSE,TRUE)
Transformation : Router (rtr_) Explanation :
Router transformation is a active transformation.
Routes data into multiple transformations based on group conditions.
A Router transformation tests data for one or more conditions and gives you the option to route
rows of data that do not meet any of the conditions to a default output group.
GROUPS ::
User Defined Groups
You create a user-defined group to test a condition based on incoming data. A user-
defined group consists of output ports and a group filter condition.
You can create and edit the user-defined group.
Default Group
The Designer creates the default group after you create one new user-defined group. The
Designer does not allow you to edit or delete the default group.
If you want the PowerCenter Server to drop all rows in the default group, do not connect
it to a transformation or a target in a mapping
REMEMBER ::
Zero (0) is the equivalent of FALSE, and any non-zero value is the equivalent of TRUE
Aggregate Functions ::
AVG COUNT FIRST LAST
MAX MEDIAN MIN PERCENTILE
STDDEV SUM VARIANCE
** Use them in an expression within an Aggregator transformation
Lookup Types ::
Connected or unconnected
Relational or flat file lookup.
Cached or uncached
Difference between Connected and Unconnected Lookup ::
Connected Unconnected
Receives input values directly from the Receives input values from the result of a :LKP
pipeline expression in another transformation.
Use a dynamic or static cache Use a static cache
Give user-defined default values Not accepts user-defined default value
Return multiple column Returns only one column
Pass multiple output values Passes one output value
Cache includes all lookup columns used in Cache includes all lookup/output ports in the
the mapping lookup condition and the lookup/return port
No match for the lookup condition::returns No match for the lookup condition:: PCS returns
the default value for all output ports NULL
Match for the lookup condition::returns the Match for the lookup condition:: returns the
result of the lookup condition for all result of the lookup condition into the return port
lookup/output ports
Lookup Cache ::
we can save the lookup cache files and reuse them the next time the PCS
Persistent
processes a Lookup transformation configured to use the cache
If the persistent cache is not synchronized with the lookup table, you can
Recache
configure the Lookup transformation to rebuild the lookup cache.
It caches the lookup file or table and looks up values in the cache for each row
that comes into the transformation. When the lookup condition is true, the
Static PowerCenter Server returns a value from the lookup cache.
PCS does not update the cache while it processes the Lookup transformation
If you want to cache the target table and insert new rows or update existing
rows in the cache and the target, you can create a Lookup transformation to
Dynamic use a dynamic cache. The PowerCenter Server dynamically inserts or updates
data in the lookup cache and passes data to the target table. You cannot use a
dynamic cache with a flat file lookup.
You can share the lookup cache between multiple transformations. You can
share an unnamed cache between transformations in the same mapping. You
Shared
can share a named cache between transformations in the same or different
mappings.
Constants
Constant Value
Insert DD_INSERT 0
Update DD_UPDATE 1
Delete DD_REJECT 2
Reject DD_REJECT 3
Update Strategy Expressions
IIF( Submit Date > Last Date,DD_INSERT, DD_UPDATE)
'DD' :: Data Driven
Perform joins in a database when possible
Create a pre-session stored procedure to join the tables in a database.
Use the Source Qualifier transformation to perform the join.
Mapping Flow : Source Definition (Flat File) > Source Qualifier > Expression (column names) >
Normalizer transformation (converts single row into multiple rows)> Target Definition (flat file)
Designing : We designed this mapping using INFORMATICA tool version 7.1.1 .
Description :
Source Definition
ESA
ENO ENAME EAGE
L
100 JOHN 2000 23
101 SMITH 5000 41
102 LUCKY 6000 32
Target Definition
COL_NA COL_VA
ENO
M L
100 ENAME JOHN
100 ESAL 2000
100 EAGE 23
101 ENAME SMITH
101 ESAL 5000
101 EAGE 41
102 ENAME LUCKY
102 ESAL 6000
102 EAGE 32
Create stored procedures to automate tasks that are too complicated for standard SQL
statements.
DESIGNER ::
stored procedures to do the following tasks:
Check the status of a target database before loading data into it.
Determine if enough space exists in a database.
Perform a specialized calculation.
Drop and recreate indexes.
Stored Procedure
Template Appereance
SAL
REV_SAL
Mapplet One : The object of this mapping is used to obtain total employees who are getting SAL
>1000
Explanation : A mapplet is a reusable object that you create in the Mapplet Designer. It contains
a set of transformations and allows you to reuse that transformation logic in multiple mappings.
The advantage of Mapplet is used to reuse the the set of transformation in multiple mappings.
Mapplet Two : The object of this mapping is used to obtain the employee info who is getting
maximum salary.
Explanation :
A mapplet is a reusable object that you create in the Mapplet Designer. It contains a set of
transformations and allows you to reuse that transformation logic in multiple mappings.
Mapplet Input :: You can pass data into a mapplet using source definitions and/or Input
transformations. When you use an Input transformation, you connect it to the source pipeline in
the mapping
Mapplet Output :: Each mapplet must contain one or more Output transformations to pass data
from the mapplet into the mapping.
Input mapplet > sorter > filter > expression > output mapplet
source definition > source wualifier > mapplet > target definition
Advantage
Certification Point ::
You cannot include the following objects in a mapplet:
Normalizer transformations
Cobol sources
XML Source Qualifier transformations
XML sources
Target definitions
Pre- and post- session stored procedures
Other mapplets
1. Create a worksheet.
4
Informatica 7.x vs 8.x
Ans
In Informatica 8.1 has an addition of transformations and supports different unstructured data.
Introduced:
1. sql transformation
2. java transformation
3. support unstructured data like emails, word doc, and pdfs.
4. In custom transformation we can build the transformation using java or vc++
5.Concept of flat file updation is also introduced in 8.x
Object Permissions
Effective in version 8.1.1, you can assign object permissions to users when
you add a user account, set user permissions, or edit an object.
Effective in version 8.1, you configure the gateway node and location for
log event files on the Properties tab for the domain. Log events describe
operations and error messages for core and application services, workflows
and sessions.
We can configure the maximum size of logs for automatic purge in megabytes.
Powercenter 8.1 also provides enhancements to the Log Viewer and log event
formatting.
Unicode compliance
You may notice an increase in memory and CPU resource usage on machines
running PowerCenter Services.
License Usage
High Availability