create a job to get the previous row salary for the current row.if there is no previous row exists for the current row,then the previous row salary should be displayed as null?
empid   salary   previoussalary
10      1000     null
20      2000     1000
30      3000     2000      
40      4000     3000

Answers were Sorted based on User's Feedback



create a job to get the previous row salary for the current row.if there is no previous row exists f..

Answer / venkata ramana

Input:Seq file
empid,salary
10,1000
20,2000
30,3000
40,4000

Sequential file stage--->Trasformar Stage---->Dataset Stage

Transformation Logic:

InputTab-->Partition--> select "same"---> Select "Perform Sort" on key "empid"

Declaration of Stage Variables:

PrevSal Varchar ( Set right Intial value ' ' i.e Null value)
CurSal Varchar

Derivation Stage Variables
---------- ---------------
CurSal PrevSal
Linkname.Salary CurSal

Derivation Column name
--------- -----------
Linkname.empid empid
Linkname.Salary Salary
PrevSal previoussalary

Output DataSet result:-
empid salary previoussalary
10 1000 null
20 2000 1000
30 3000 2000
40 4000 3000

Is This Answer Correct ?    7 Yes 3 No

create a job to get the previous row salary for the current row.if there is no previous row exists f..

Answer / indu

inputfile-->transformer-->outputfile




create stage variables 
current salary
previous salary(intialize this to null)




derive them as below:
current salary-->previous salary
previous salary---> salary




in the output file derive previous salary as below




previoussalary--->current salary

Is This Answer Correct ?    3 Yes 2 No

create a job to get the previous row salary for the current row.if there is no previous row exists f..

Answer / indu

input file-->transformer--> output file

declare stage varibales
current salary
previous salary  and initialize the previous salary to null

current salary--> previous salary
previous salary->salary

in the output file derive previousalary as
previoussalary-->current salary (stage variable)

Is This Answer Correct ?    3 Yes 2 No

create a job to get the previous row salary for the current row.if there is no previous row exists f..

Answer / anil

1. Input file-> Transformer -> Peek
2. Keep Tranformer in sequential mode or Make partition as same
3. Two stage variables
StgPrevSalary 
StgCurrSalary

Derivations - StgVariables
StgCurrSalary- StgPrevSalary
Sal-           StgCurrSalary

Output
Emp
StgCurrSalary
StgPrevSalary

Is This Answer Correct ?    1 Yes 0 No

create a job to get the previous row salary for the current row.if there is no previous row exists f..

Answer / indu

input file->transformer-> output file

in transformer declare stage variables as below:
current salaray
salary
previous salary

Initialize previous salary to null

current salary ---> previous salary
previous salary----> salary



In the output file derive the previous salary as

previousalary--->previous slary (stage variable)

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Data Stage Interview Questions

difference between function and procedure...

1 Answers   IBM,


What are the different common services in datastage?

0 Answers  


root tree will find which is server job and which is parallel job?

0 Answers   IBM,


i WANTED TO USE THE RANGE LOOKUP SCENARIO IN DATASTAGE 7.5.2 SRVER JOB.i HAVE A DATE FIELD IN SOURCE AND I SHOULD MATCH IT WITH A FIELD IN LOOKUP FILE.BUT,THE FIELDS SHOULD MATCH EVEN THOUGH THERE IS SOME RANGE.CAN SOMEONE TELL ME HOW CAN I DO THAT. THANKS

0 Answers  


source file contains 100 records, i want 10 records in target file how it possible in datastage

6 Answers   IBM,






Please tell me What is difference between 8.0 and 8.1

1 Answers   IBM,


What is lookup table?

5 Answers  


source file having the data like aabbccc, i want target file result like a1a2b1b2c1c2c3.

2 Answers  


How to Remove Duplicate using SQL?

0 Answers   CTS,


there are two schemas x and y are there. some data is in x schema. i want to use that in y schema..how can i use? please give some possibilities

2 Answers   Wipro,


WHAT ARE THE COMMON ERRORS IN DATA STAGE?

6 Answers   IBM, ME,


can any one tell me how to install datastage 8.1 in windows xp with wizard

2 Answers  


Categories