Vous êtes sur la page 1sur 3

Informatica Real Time Scenarios:

Q1) Alternate Target Loading

My source is a flat file which contains N number of records. I want to load the
source data into two targets such that first five records should loaded into the
first target, next five records into the second target table. Again the next source
five records into the first target table and so on. How to implement a Informatica
mapping logic for this?

Solution:

Connect the source qualifier transformation to the expression


transformation. In the expression transformation, create the below additional
ports:

v_cnt (variable port) = v_cnt+1

o_cnt (output port) = v_cnt

Connect the expression transformation to the router transformation.


Create two output groups in the router transformation and specify the following
filter conditions:

--Filter condition for first output group

DECODE(substr(o_cnt,-1,1),1,TRUE,2,TRUE,3,TRUE,4,TRUE,5,TRUE,FALSE)

--Filter condition for second output group

DECODE(substr(o_cnt,-1,1),6,TRUE,7,TRUE,8,TRUE,9,TRUE,0,TRUE,FALSE)
Connect the router transformation output groups to the appropriate
targets.

Q2) Load source data in multiple session run.

I have flat file as a source which contains N number of records. My requirement


is to load half of the source data into the target table in the first session run and
the remaining half of the records in the second session run. Create Informatica
mapping to implement this logic? Assume that the source data does not change
between session runs.

Solution:

Create a mapping to find out the number of records in the source and write
the count to a parameter file. Let call this parameter as $$SOURCE_COUNT.
Create another mapping. Go to the mapping parameters and variables,
create a mapping variable ($$VAR_SESSION_RUNS) with integer data type.
Connect the source qualifier transformation to the expression
transformation. In the expression transformation, create the below additional
ports.

v_Count (variable port) = v_Count+1

O_Run_flag (output port) = IIF($$vAR_SESSION_RUNS=0,

setvariable($$vAR_SESSION_RUNS,1),

IIF( !ISNULL($$vAR_SESSION_RUNS)

and v_Count=1,

2,

$$vAR_SESSION_RUNS)

O_count (output port) = V_Count


Connect the expression transformation to the filter transformation and
specify the following filter condition:

IIF (O_Run_Flag =1, v_count<= $$SOURCE_COUNT/2,

IIF (O_Run_Flag =2, v_count > $$SOURCE_COUNT/2))

Connect the filter transformation to the target.


Here i am assuming that you know how to use a parameter file. That is why
I did not specify the complete details.

Vous aimerez peut-être aussi