Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

What steps should be taken to improve Datastage jobs?

1052


What are routines in datastage?

1313


What are the difference types of stages?

1187


what is the difference between == and eq in UNIX shell scripting?

1482


How do y read Sequential file from job control?

15920


What is meta stage?

1167


To see hidden files in LINIX?

1511


Where do the datastage jobs get stored?

1191


What are some prerequisites for datastage?

1077


Define data aggregation?

1083


if we using two sources having same meta data and how to check the data in two sources is same or not? and if the data is not same i want to abort the job ?how we can do this?

2217


A signal has a wavelength of 1 micro min in air.how far can the front of the wave travel during 1000periods?

2491


What is oci?

1286


Distinguish between informatica & datastage. Which one would you choose and why?

993


Difference between ‘validated ok’ and ‘compiled’ in data stage?

1248