Variable Length Vector to Delimited String Array

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
rameshrr3
Premium Member
Premium Member
Posts: 609
Joined: Mon May 10, 2004 3:32 am
Location: BRENTWOOD, TN

Variable Length Vector to Delimited String Array

Post by rameshrr3 »

I have a data in which one column is a vector
data looks like this
[^X 2 4 22 22 19 8 ]
^X is the vector length prefix ( 1 bytes)
the rest are elements of the vector.

Is there any way i can convert the output to a delimited string array ?
Output should be like
'2'|'4'|'22'|'22'|'19'|'8'|

I could do a column export with appropriate delimiter & quote char and use modify stage to remove the 1 byte prefix using spec : substring[1,x](colname), and remove the vector definition from the output column using edit column metadata - but i think its not an elegant way of doing so - even though it seems to achieve the desired result.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Doesn't seem inelegant to me. You could investigate the Split Vector 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.
rameshrr3
Premium Member
Premium Member
Posts: 609
Joined: Mon May 10, 2004 3:32 am
Location: BRENTWOOD, TN

Post by rameshrr3 »

Yes , I countinued with the 'workaround' I have ( The modify stage trimming made it look inelegant to me ) . But i think the variable length vector can be padded ( or defined in column metadata) to a fixed length that will be all inclusive . The split vector stage will require a fixed length vector input to work. The trick with split vector stage is to name the split columns the same name as the vector input column , appended with an index number staring with 0 to n-1 ( For a fixed vector of n elements)
Post Reply