Hi guys,
7. how to get this output
i/p
col1,col2
101,a
102,b
103,c
104,d
o/p
col1,col2
101,d
102,c
103,b
104,a
Thanks
Answers were Sorted based on User's Feedback
Answer / ankit gosain
Hi all,
For this scenario, construct a job like:
SeqFile------>Transformer------>Transformer----->SeqFile
Firstly, Change the execution mode of both the transformers
from default(parallel) to sequential.
Now, create a stage variable of varchar type in 1st
Transformer (say temp) & assign a default value to it
(say 'Ankit').
Now write in its derivation:
if temp='Ankit' then col2 else temp:',':col2
Now give the o/p derivation for the two columns as:
col1---col1
temp---col2
Now go to the 2nd Transformer & go to input tab and mention
the sorting on col1 as descending, create 3 stage variables
in it:
count1 of integer type with 0 as default value,
temp1 of varchar type with 'Ankit' as default value,
temp2 of varchar type.
then write in their derivation:
count1+1----------------------------------count1
if temp1='Ankit' then col2 else temp2-----temp1
temp1-------------------------------------temp2
Now write in O/p derivation of the columns:
col1-----------------------col1
field(temp2,',',count1)----col2
Now, do the sorting (ascending) on col1 in the o/p seqFile,
and drag & drop both the columns to the o/p link derivation
and you wil get the desired result.
If you have further queries, mail me on
ankitgosain@gmail.com
Cheers,
Ankit :)
Is This Answer Correct ? | 7 Yes | 1 No |
Answer / anil
1. Take a copy of the file in two links where id only in one link and value in another link.
2. For id link add a column generator for giving row number(Temp). Run this in sequential mode. Parition by Sort Merge (ascending)
3. For value link add a column generator for giving row number(Temp). Run this in sequential mode. Parition by Sort Merge (descending).
4. Now add look up between two columns with Temp as lookup.
5. You will get the output as desired.
Is This Answer Correct ? | 6 Yes | 0 No |
I have source file which contains duplicate data,my requirement is unique data should pass to one file and duplicate data should pass another file how?
How to clean the datastage repository?
how to closeing records after 10,000 records come?
What is the difference between Link collector and Funnel Stages?
why we use parameters instead of hard code in datastage
which memory is used by lookup and join
Explain the functionality of your current project?
1 Answers IBM, Miles Software,
how can we perform the 2nd time extraction of client database without accepting the data which is already loaded in first time extraction
1)what is the size of Fact table and dimension table? 2)how to find the size of Fact table and dimension table? 3)how to implement the surrogate key in transform stage? 4)write the configuration file path? 5)how many types of datasets explain? 6)diff b/w developed projects and migration projects? 7)how to delete the header and footer file of the sequencer file? 8)how can u call the parameters in DS in unix environment? 9) how much data ur getting daily ? 10)
hi All, i have one scenario like if source--->transformer-->2 target sequential files the 1 st target sequential file is loads the data from source and 2nd target sequntial file contain the 1st target total record count,and file name of 1 st target seq file and timestamp seperated by delimeter for example if source have 10 record the 1st target seq file hav 10 records and 2nd target seq file example 10|xyz.txt|20101110 00:00:00 could you please help me out how can i implement in datastage job.
how to define satge variables in transformer stage
when U have a remove dublicate option in sort stage, why we have a remove dublicate stage in PX, thought it is recamended to sort data before using a remove dublicate stage. I hae been thinking this from days....