Rows to single Column

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
Mallayagari
Participant
Posts: 15
Joined: Tue Apr 20, 2004 3:10 am

Rows to single Column

Post by Mallayagari »

I have multiple records (varies from 10 to 50) having only one date field and I want to write to a sequentail file as one record with all the dates appended.

I want to use these in a job parameter in the next job. Is there any other way of passing the parameters to the next job??

Thanks
Madhav
reachthiru
Participant
Posts: 28
Joined: Mon Jan 09, 2006 1:31 pm

Post by reachthiru »

Hi Madhav,

There are multiple ways to do that. If you want it to write to a sequential file, you can read each record and whle writing it to a sequential file, write it with the record delimiter as 'comma(,)'. So all the records will be written to a single record.

Other way is, create 2 stage variables,

ex

Code: Select all

A=','
L=len(A)
Then for each record

Code: Select all

A[l]=<your input field> : ',,'
L=len(A)
At the end remove the last 2 commas. Then you are all set.

Pls let me know if it works.
With regards,
Thiru
Mallayagari
Participant
Posts: 15
Joined: Tue Apr 20, 2004 3:10 am

Post by Mallayagari »

[quote="reachthiru"]Hi Madhav,

There are multiple ways to do that. If you want it to write to a sequential file, you can read each record and whle writing it to a sequential file, write it with the record delimiter as 'comma(,)'. So all the records will be written to a single record.

Other way is, create 2 stage variables,

ex
[code]A=','
L=len(A)[/code]

Then for each record
[code]A[l]=<your input field> : ',,'
L=len(A)[/code]
At the end remove the last 2 commas. Then you are all set.

Pls let me know if it works.[/quote]

Thanks Thiru
It worked with the first option.

-Madhav
Post Reply