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
Answer Posted / 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 |
Post New Answer View All Answers
Explain how a source file is populated?
What is the difference between in process and inter process?
State the difference between an operational datastage and a data warehouse?
project Steps,hits, Project level HArd things,Solved methods?
what is ds administrator used for?
What is staging variable?
How will you load you daily/monthly jobs datas in to Fact and Dimension table using datastage.
What are the various kinds of containers available in datastage?
what is the custome stage in datastage? how can we impliment that one? plz tell me
Can you implement SCD2 using join, transformer and funnel stage?
Difference between ‘validated ok’ and ‘compiled’ in data stage?
How do you schedule or monitoring the job?
How the ipc stage work?
In a batch if a job fails in between and you want to restart the batch from that particular job and not from the scratch then what will you do?
Define oconv () and iconv () functions in datastage?