A,B,C ---> a b c

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
vinaymanchinila
Premium Member
Premium Member
Posts: 353
Joined: Wed Apr 06, 2005 8:45 am

A,B,C ---> a b c

Post by vinaymanchinila »

Hi ,
I have acolumn where the value is A,B,C and I want this value to be going into 3 columns

A
B
C
How do I do it, tried to look into Sting functions like Field, SubStr but of no use.
Any help is appreciated .
Thanks,
amsh76
Charter Member
Charter Member
Posts: 118
Joined: Wed Mar 10, 2004 10:58 pm

Post by amsh76 »

Look at Field function provided there is a delimiter (, in your example) as you shown in the example.

Col 1 Col 1 2 3
A,B,C A B C
amsh76
Charter Member
Charter Member
Posts: 118
Joined: Wed Mar 10, 2004 10:58 pm

Post by amsh76 »

Wait a sec...do you mean three rows ???? and not columns :roll:

If thats the case then look at Pivot Stage....

Sorry, if I misinterpreted your question.
vinaymanchinila
Premium Member
Premium Member
Posts: 353
Joined: Wed Apr 06, 2005 8:45 am

Post by vinaymanchinila »

Thanks there but I donot know it may even be A,B,C,D,E int he next column and it is varying. I did look into the Field function as said.
vinaymanchinila
Premium Member
Premium Member
Posts: 353
Joined: Wed Apr 06, 2005 8:45 am

Post by vinaymanchinila »

Pivot Stage , can it be used with server jobs ?
amsh76
Charter Member
Charter Member
Posts: 118
Joined: Wed Mar 10, 2004 10:58 pm

Post by amsh76 »

What are you trying to achieve, One column to many columns ??

Or One column to many rows ???

And Pivot is used in Server...
pnchowdary
Participant
Posts: 232
Joined: Sat May 07, 2005 2:49 pm
Location: USA

Post by pnchowdary »

vinaymanchinila wrote:Pivot Stage , can it be used with server jobs ?
Yes, pivot stage can be used with server jobs.
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

If you want them to go on multiple columns, do you know the target as the target must be properly defined to hold the max number of columns?
talk2shaanc
Charter Member
Charter Member
Posts: 199
Joined: Tue Jan 18, 2005 2:50 am
Location: India

Post by talk2shaanc »

amsh76 wrote:Wait a sec...do you mean three rows ???? and not columns :roll:

If thats the case then look at Pivot Stage....

Sorry, if I misinterpreted your question.


Pivot stage cannot be used for rows to columns conversion, pivot will help you transform the other way i.e., columns to rows.
Shantanu Choudhary
talk2shaanc
Charter Member
Charter Member
Posts: 199
Joined: Tue Jan 18, 2005 2:50 am
Location: India

Post by talk2shaanc »

Assuming that there would be another KEY column along with the column you have mentioned in your example, I would suggest you to refer the below link/post:

viewtopic.php?p=123634&highlight=#123634
Shantanu Choudhary
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

If you want N comma-delimited values into N separate columns in one row (the OP specification used the word "columns"), the output side of a Transformer stage must have Max(N) columns defined, and the Field function used to separate into separate columns.

This design should also be used if N separate rows each with one column are required. The Transformer stage is still used to separate the data into separate columns, then this output is fed into a Pivot stage. The non-matched columns in the Transformer stage output should be set to NULL.
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