How do I Restructre a Table

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
iShoreETL
Premium Member
Premium Member
Posts: 36
Joined: Wed Sep 05, 2012 9:40 pm

How do I Restructre a Table

Post by iShoreETL »

I am trying to restructure my input table. In another word the table's input columns will be the table's output rows.
Suppose I have the following INPUT table:

col1 col2 col3
==== ===== =====
1 STEVE 10.00
4 RON 15

and would like to restructure that INPUT table to the following OUTPUT table;

col_name value
======== =======
col1 1
col2 STEVE
col3 10.00
col1 4
col2 RON
col3 15


What type of existing operator/stage will do the trick. I am trying to avoid custom coding for this.
There are operators listed under "The restructure library" such as field_export, field_import, makevect, splitvect and etc. I have not worked with these operators. Can someone who used them in the past, give me the right direction.
Note: I am not dealing with COBOL or any Mainframe stuff
iShoreETL
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

That's basically a Horizontal Pivot - columns to rows.
-craig

"You can never have too many knives" -- Logan Nine Fingers
rameshrr3
Premium Member
Premium Member
Posts: 609
Joined: Mon May 10, 2004 3:32 am
Location: BRENTWOOD, TN

Post by rameshrr3 »

Can you select one column at a time in a union all statement , along with the tables current rowid and an integer representing column position ? Thenc sort them by rowid and column position? Could be faster than using any datastage operator.
Post Reply