DataStage Scenario Problem --> DataStage Scenario - Problem8
Solution Design :
a) Job Design :
Below is the design which can achieve the output as we needed. Here, we are reading 2 seq file as a input, then data is passing through a Join and Filter stage to achieve the output.
b) Join Stage Properties : For the required output, we have to join the both input file on "Col1". Here we are using FULL OUTER JOIN.
FULL OUTER JOIN will generate the 2 columns LEFT n RIGHT. Map the both columns to Join Output.
b) Filer Stage Properties : Now, In Filter Stage, We will filter the data as per requirement.
Here ....
FileA = Left and FileB = Right
So...
Data Only in FileA = where Right_Col1 = 0 or "" or NULL
Data Only in FileB = where Left_Col1 = 0 or "" or NULL
Data in both FileA and FileB = where (Right_Col1 <> 0 or "" or NULL) and (Left_Col1 <> 0 or "" or NULL)
## Note :-
Left and Right Col will be = 0 or "" or NULL if-
NULL => Data will be NULL if the Source is DB. ( But here we are using seq file )
In case of Sequence File as Source
"" => Data will be "" if the column data type is VarChar.
0 => Data will be 0 if the column data type is Integer.
Now, we will map the columns to output.
For "Data available only in FileA" :- Assign Left to Output.
For "Data available only in FileB" :- Assign Right to Output.
For "Data available in Both " :- Assign Right or Left to Output.
For More ---> VISIT THIS LINK
No comments :
Post a Comment