subhash


{ City } hyderabad
< Country > india
* Profession * datastage developer
User No # 101246
Total Questions Posted # 15
Total Answers Posted # 100

Total Answers Posted for My Questions # 43
Total Views for My Questions # 145498

Users Marked my Answers as Correct # 554
Users Marked my Answers as Wrong # 33
Answers / { subhash }

Question { TCS, 10130 }

I have Seq file, I don't want 10, 11th(or any two records like 20, 30th records ) records in the output


Answer

If we use @INROWNUM, then we have to run transformer on 'single' NODE.

Is This Answer Correct ?    8 Yes 0 No

Question { IBM, 7725 }

Hi guys,

please design job for this,

MY INPUT IS

COMPANY,LOCATION
IBM,CHENNAI
IBM,HYDRABAD
IBM,PUNE
IBM,BANGLOORE
TCS,CHENNAI
TCS,MUMBAI
TCS,BANGLOORE
WIPRO,HYDRABAD
WIPRO,CHENNAI
HSBC,PUNE

MY OUTPUT IS

COMPANY,LOCATION,COUNT
IBM,chennai,hydrabad,pune,banglore,4
TCS,chennai,mumbai,bangloore,3
WIPRO,hydrabad,chennai,2
HSBC,pune,1


Thanks


Answer

what Ankit explained is correct. but small correction:
as per abouve explanation we get o/p location as below:
LOCATION
,chennai,hydrabad,pune,banglore
,chennai,mumbai,bangloore
,hydrabad,chennai
,pune

So, we need to do LTRIM/TRIM Function in devivation of the
column:
TRIM(temp1,',')---------->Location

then we get desired output.

Is This Answer Correct ?    1 Yes 0 No


Question { L&T, 8281 }

i have a scenario in which i/p columns areID,salary with
1,1000 2,2000 and 3,3000 i need an extra column in the o/p
named avg(salary)how can i get it?


Answer

source -> Transforemer(add column DUMMY and give value 1)
==> 2links,
1st link(with 1 hard coded value) to Copy,
1,1000,1
2,2000,1
3,3000,1
2nd Link to Join,
1,1000
2,2000
3,3000

1st linkcopy -> aggregate (Group Key-->DUMMY, take avg)--
>Join
1,2000(AVG salary)
->Join --> target
1,1000,2000
2,2000,2000
3,3000,2000

Is This Answer Correct ?    2 Yes 1 No

Question { Wipro, 9992 }

whats relation between configuration file and datasets?


Answer

Datasets- Preserves the Partitions. i.e, Data in the
datasets store on diff nodes which specified in the Config
File.

Resource Disk path in the Config File specifies in which
locations the data(Dataset's data) store.

Dataset contains: Data File and Schema file
Schema file(contains header and address of data file)stores
in dataset path(which we mention in the job)
Data File store in the Resource Disk Path, which specified
in the config file.

Is This Answer Correct ?    5 Yes 0 No

Question { Wipro, 10106 }

My input has a unique column-id with the values 10,20,30.....how can i get first record in one o/p file,last record in another o/p file and rest of the records in 3rd o/p file?


Answer

We can do in this way as well:

In the same job,
SeqFile--->Target1
SeqFile--->Target2
SeqFile--->Target3
for Target1,
add Filter condition in the SeqFile as below:
Head -1

for Target2,
add Filter condition in the SeqFile as below:
Tail -1

for Target3,
add Filter condition in the SeqFile as below:
sed '1,$ d'

Is This Answer Correct ?    8 Yes 2 No

Question { Cap Gemini, 12029 }

file1
1
2
3
4
file2
3
4
5
6

output should be in three targets
T1 T2 T3
1 3 5
2 4 6

how to do this? can any one help?

Thanks


Answer

Using change capture stage:

File1(Master),File2----> change capture---> Filter ---->
T1, T2, T3
In Filter,
Change_code=1 then send then to T1-->(Insert records)
Change_code=0 then send then to T2-->(Copy records)
Change_code=2 then send then to T3-->(Delete records)

Is This Answer Correct ?    24 Yes 1 No

Question { Wipro, 11105 }

My source having following data as below,
AB1
Aim2
Abnv5
1An8bx
and my question is i need the Datastage job the following
as in my target

000AB1
00Aim2
0Abnv5
1An8bx
Please help me to achive this.


Answer

In the Output Column Derivation of Transformer Stage:

1. Way:
Str('0',6-Len(string)): Input_Col--->Output_Col

2. Way:
right("000000" : Input_Col),6) --->Output_Col

3. Way:
Right(Str("0",6) : Input_Col),6) --->Output_Col
Right(Str("0",3) : Input_Col),6) --->Output_Col

Is This Answer Correct ?    1 Yes 0 No

Question { SLK Software, 12110 }

i have input like this

Column 1 ,column 2
3,a
4,b
5.c

i want outputĀ 
aaa
bbbb
ccccc

Ple help any one?


Answer

Ex:
Str( "a", 3)---->aaa
Str( "b", 4)---->bbbb

Solution:
use below transformer Logic in Output Col Derivation:

Str(DSLink2.col2, DSLink2.Col1)--->Output_Col(Output Column)

Output:

Output_Col
aaa
bbbb
ccccc

Is This Answer Correct ?    3 Yes 0 No

Question { IBM, 5539 }

in datastage interview qustion

source target
------- -------
12345 1
2
3
4
5


Answer

SRC-->TFM--->TGT
in TFM, Use Stage variables and Loop variables as below:

StageVar-->Len(Lnk.Source)===>this will give length of string of "Source" column. i.e.,

Source StageVar
12345 5


Next, in the Loop variable part:
Loop While==> @ITERATION<= StageVar
For input row, Loop will repeat until "Source" length(5) finishes.

Add new Loop variable-->LoopVar and put below derivation:
Left(Lnk.Source, @ITERATION)-->LoopVar

Next, in the Output Col Derivation:

LoopVar-->Target
Ex:
For 1st ITERATION: Left("12345", 1)==>1
For 2nd ITERATION: Left("12345", 2)==>2
....
....
Finally, you will required Output.

Is This Answer Correct ?    2 Yes 1 No

Question { HSBC, 7393 }

which unix commands mostly used in datastage


Answer

head/tail
grep
sed
ps
cut
find
date

Is This Answer Correct ?    6 Yes 1 No

Prev    1   2   3   4   5   6    [7]