how to transform the given input to output format

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
rockunder78
Participant
Posts: 8
Joined: Mon Jun 18, 2007 11:08 pm
Location: chennai

how to transform the given input to output format

Post by rockunder78 »

hi, can any one give me some idea how to get the below output.

Input

Name,Sal,Month

Hari,2000,Jan

Hari,1000,March

Gokul,3000,Jan

Ganesh,4000,Feb

Jagadish,5000,Jan

Jagadish,6000,Feb



Output

Name, Jan , Feb, March

Hari, 2000, 0 , 1000

Gokul, 3000, 0 , 0

Ganesh , 0 ,4000, 0

Jagadish, 5000,6000, 0
kamesh_sk
Participant
Posts: 43
Joined: Fri May 27, 2005 7:58 am

use your pivot

Post by kamesh_sk »

use your pivot stage
rockunder78
Participant
Posts: 8
Joined: Mon Jun 18, 2007 11:08 pm
Location: chennai

Post by rockunder78 »

please guide me how to do in pivot.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Won't work as the Pivot stage does 'Columns to Rows'. I'd use a hashed file here, keyed by Name where you read and write to it in the same transformer. The first 'miss' gets the whole record written out with two of the three fields set to zero. Each 'hit' after that updates whatever month you are processing.

Afterwards, source from the hashed file to get the final results.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply