Generate columns dynamically

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
savis
Premium Member
Premium Member
Posts: 27
Joined: Tue Apr 15, 2008 11:06 pm

Generate columns dynamically

Post by savis »

Hi,

Is there a way to generate columns dynamically?

If suppose, i have input files like:

file 1:

col1,col2,col3,col4

file 2:

col1,col2,col3,col4,col5

file 3:

col1,col2,col3,col4,col5,col6.

If the datatypes of all files are same, then can i use a single job for handling all the three input files?

please suggest..

Thanks,
Savis
keshav0307
Premium Member
Premium Member
Posts: 783
Joined: Mon Jan 16, 2006 10:17 pm
Location: Sydney, Australia

Post by keshav0307 »

Yes,
read teh record as a single column, and then in trasformer split the record into different columns, based on the delimiter position,
you can use field function for it
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

It depends on what you want to with the file. If you need to just read it and load it in output, then the above mentioned method can be used, or even schema file option can be availed.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
ag_ram
Premium Member
Premium Member
Posts: 524
Joined: Wed Feb 28, 2007 3:51 am

Post by ag_ram »

As kumar_s stated, it depends on how far you have clear meaning of the word"handling" in your sentence
savis wrote:If the datatypes of all files are same, then can i use a single job for handling all the three input files?
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

The easiest complete approach is to use the Schema File property in the Sequential File stage, and set is value to a file that properly represents the record schema of the file that the generic job processes.
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