Importing column definition from file

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
parameswar
Premium Member
Premium Member
Posts: 66
Joined: Sun Apr 08, 2007 12:34 pm

Importing column definition from file

Post by parameswar »

Hi,

I have to import column definition from csv file. File structure is given as below:
Column Name,Type,Size,Constraint
ID,Number,10,Primary Key
C_ADDR1,Char,80,
C_ADDR2,Char,80,
C_ADDR3,Char,80,
C_CITY,Char,25,
C_CNTRY,Char,5,

There are 180 columns in this file. Please help me if there is any way to import column definition in manager.

Thanks,
Parameswar
shivajid2k
Participant
Posts: 19
Joined: Mon Feb 14, 2005 11:34 pm

Re: Importing column definition from file

Post by shivajid2k »

Place your file in Datastage server. Login to Datastage manager and goto Import ---> Table definitions-->Sequential file.

Select the filename from directory where you placed that file and import.



dssiva

[quote="parameswar"]Hi,

I have to import column definition from csv file. File structure is given as below:
Column Name,Type,Size,Constraint
ID,Number,10,Primary Key
C_ADDR1,Char,80,
C_ADDR2,Char,80,
C_ADDR3,Char,80,
C_CITY,Char,25,
C_CNTRY,Char,5,

There are 180 columns in this file. Please help me if there is any way to import column definition in manager.

Thanks,
Parameswar[/quote]
surendra_ds
Participant
Posts: 12
Joined: Wed Apr 19, 2006 7:41 am

hi

Post by surendra_ds »

Hi

Can you paste the error message, it would be use ful to give a solution for your query..

As normal way to import metadata..just follow shivajid2k
steps.
parameswar
Premium Member
Premium Member
Posts: 66
Joined: Sun Apr 08, 2007 12:34 pm

Re: hi

Post by parameswar »

surendra_ds wrote:Hi

Can you paste the error message, it would be use ful to give a solution for your query..

As normal way to import metadata..just follow shivajid2k
steps.
Thanks for your reply. Actually I am not getting any error in importing column definition. I am clearly defining the requirement again:
I have the flatfile(test1.txt) which is fixed length record format and having no column name & no delimiter in that file. In another csv file (test2.csv) only column definition is given for the above file test1.txt.

==== test2.csv=========

Column Name,Type,Size,constraint
ID,Number,10,Not Null
Name,Char,25,Not Null
Age,Number,2,Not Null
Filler1,Char,10,
DOB,date,10,
Address,Varchar,50,
Filler2,Char,20,


Since it is fixed length record file(test1.txt), field possition and its order is important. one solution is that I have to type the definition for each column to read the file. But this metod is fully boring if I have more then 100 columns.Is there any other better approach to import the column definition from test2.csv file which can be used to read the file test.txt .


Thanks,
Parameswar
k1980pc
Participant
Posts: 9
Joined: Fri Jun 15, 2007 3:31 am

Re: hi

Post by k1980pc »

I had to do the same for one of my clients. I ended up writing a macro for creating ddl from the spreadsheet, executed in a temp oracle schema and imported the metadata from there. The number of tables was pretty huge, so it was worth the one time effort :)

PS : The tool was not Datastage, so there might be better options in DS.
RELAXEN UND WATSCHEN DER BLINKENLICHTEN
parameswar
Premium Member
Premium Member
Posts: 66
Joined: Sun Apr 08, 2007 12:34 pm

Re: hi

Post by parameswar »

k1980pc wrote:I had to do the same for one of my clients. I ended up writing a macro for creating ddl from the spreadsheet, executed in a temp oracle schema and imported the metadata from there. The number of tables was pretty huge, so it was worth the one time effort :)

PS : The tool was not Datastage, so there might be better options in DS.
Can somebody help, is there any better approach in Datastage to meet the above requirement.


Regards,
Param
Yuan_Edward
Participant
Posts: 73
Joined: Tue May 10, 2005 6:21 pm
Location: Sydney

Re: Importing column definition from file

Post by Yuan_Edward »

I cann't see there is a direct way to do it, but maybe it is not hard to translate the column definition csv file into a DataStage schema file.
parameswar wrote:Hi,

I have to import column definition from csv file. File structure is given as below:
Column Name,Type,Size,Constraint
ID,Number,10,Primary Key
C_ADDR1,Char,80,
C_ADDR2,Char,80,
C_ADDR3,Char,80,
C_CITY,Char,25,
C_CNTRY,Char,5,

There are 180 columns in this file. Please help me if there is any way to import column definition in manager.

Thanks,
Parameswa
Edward Yuan
Post Reply