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
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 |
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 |
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 |
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 |
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 |
SOURCE LIKE I_D,F1,F2 --------- 100,N,Y 100,N,N 100,Y,N 101,Y,Y 101,N,Y 102,Y,N 103,N,N 104,Y,Y 105,N,N 106,N,Y 102,N,Y 105,Y,Y O/P LIKE ID flag1 flag2 101 Y Y 101 N Y 102 Y N 102 N Y 104 Y Y 106 N Y
deptno wise to find max and min,and sum of rows and in target to company wise maximum
What are the different options associated with dsjob command?
where the log files or tables can store in DS?
how to handle null values using transformer stage?
i have source like balance,drawtime 20000, 8.30 50000,10.20 3000,4.00 i want target like this balance,drawtime 20000, 20.30 50000,22.20 3000,16.00
Define orabulk and bcp stages?
What are some prerequisites for datastage?
What is Horizontal transformation, vertical transformation,diagonal transformation?
what is the best stage in datastage parller jobs to use full out join and why
pls ,tell me good Training centre with Job Oppertunity for Data stage in chennai?
1)s.key generate 1 to 700 records today. tomorrow another 400 will updated how to update the records using s.key generator? 2)source is like :-- DB --> T/F stage1 --> seq1file T/f 1 is linking with T/F2 ---> seq 2 how to load the data? in source i given some conditions those r going in seq1. The another data will going to seq2 how to do this ?