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
On which Dimension Table you implemented SCD Type in your Project
Name the different sorting methods in datastage.
What are iconv and oconv?
What is the command line function to import and export the ds jobs?
How do you import and export data into datastage?
How do you schedule or monitoring the job?
Define repository tables in datastage?
What is the use of hoursfromtime() function in transformer stage in datastage?
Differentiate between odbc and drs stage?
What is the difference between informatica and datastage?
What is the precedence of stage variables,derivations, and constraints?
Can you explain tagbatch restructure operator?
State the difference between an operational datastage and a data warehouse?
Describe the architecture of datastage?
What are the different kinds of views available in a datastage director?