one 12 columns in rows (not for all the data file)

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
samp
Participant
Posts: 25
Joined: Thu Nov 06, 2003 4:34 am

one 12 columns in rows (not for all the data file)

Post by samp »

hello, il explain what i mean.

i have a csv file like that.

X Y Z V
ax ax ax ax
F1 0.1 0.2 0.1 0.6
F2 0.3 0.4 0.1 0.2
F3 0.9 0.8 0.4 0.7

i would like to have this file at end.


F1 X 0.1
F1 Y 0.2
F1 Z 0.1
F1 V 0.6
F2 X 0.3
F2 Y 0.4
F2 Z 0.1
F2 V 0.2
F1 X 0.9
F3 Y 0.8
F3 Z 0.4
F3 V 0.7

is it possible, i hear about PIVOT table, but i don't know if it matches with my problem

thanks for your help
WoMaWil
Participant
Posts: 482
Joined: Thu Mar 13, 2003 7:17 am
Location: Amsterdam

Post by WoMaWil »

yes pivot is one answer, when you always have the same number, else a hashfile with multivalue, perhaps the multivalues generated by a routine may be an answer.

This is a often seen question, so do a search in the forum for the details of the "how-to"
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

That one would requre a certain extra, you need to preserve the values from the first line in the file, discard the second line, and process the remainder.
The first line can be preserved in a stage variable. Its derivation would be of the form IF @INROWNUM=1 THEN col1:",":col2:",":col3:",":col4 Else stagevariable.
You can use an output constraint (@INROWNUM > 2) to cause only lines 3 and beyond to be processed.
The remainder should be able to be done with a pivot stage.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply