How to read the attached file using sequential file stage

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
cbhutani2
Participant
Posts: 8
Joined: Wed Mar 18, 2009 1:08 am

How to read the attached file using sequential file stage

Post by cbhutani2 »

Hi,
A source file is given to me as csv file but when I open it, it looks like a normal excel file.
How do I read it using sequential file stage. The file is having extn .csv, but opens normally as a excel file having columns, Bank_id, bank_desc, Bank_Branch_id, Bank_branch_desc,Bank_branch_address etc.

You can assume that when one views that file, it opens normally as, the column headings in the first line and from 2nd row onwards the data. There are no delimiters, similar to the data as in an excel file.

Under the properties tab, I have selected 'first row is column names' and selected the csv file.

For format tab, cud u pls let me know what I have to select for:
Record level -> final delimiter?
Field defaults -> delimiter?
Field defaults -> quote?

Or anything else which needs to be done to read such a file?
Sumati
sureshreddy2009
Participant
Posts: 62
Joined: Sat Mar 07, 2009 4:59 am
Location: Chicago
Contact:

import that from sequential file definitions

Post by sureshreddy2009 »

:lol:
Hi
First import from sequential file definitions,at the time of importing select first line is column names and import into datastage,
then in the sequential file , as u already done select firstline is column names and import the table definitions at columns tab,
now the point here is you dont want to set format tab manually, go to sequential file format tab and there import option is there at bottom of that format page, import that file table definitions into format tab, then it will automatically sets the format,
i think the file is fixed length file
Suresh Reddy
ETL Developer
Research Operations

"its important to know in which direction we are moving rather than where we are"
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Your first job is to find out what kind of file it is. That a CSV file opens in Excel is perfectly normal because CSV is associated with Excel in your Windows environment. You need to bypass that association, for example using "Open With..." from the right-click menu. If all is good you can import the table definition from the CSV file and read it normally using a Sequential File stage.

There is no final delimiter - remove this property. The field delimiter is comma and the quote character is whatever is in the file - either double or none would be my guess.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
p.amutha
Participant
Posts: 1
Joined: Tue May 06, 2008 2:38 am

Post by p.amutha »

Hi,

We should set the below property to read the *.csv file in sequential stage

Record level -> final delimiter->none
Field defaults -> delimiter->comma
Field defaults -> quote->none
cbhutani2
Participant
Posts: 8
Joined: Wed Mar 18, 2009 1:08 am

Re: import that from sequential file definitions

Post by cbhutani2 »

Hi Suresh,
When I did all the steps, you have said, and did view data,
it gives error on view data as:
<main program> Accept timed out retries=4.

Could you pls help.

Regards,
Sumati.
sureshreddy2009 wrote::lol:
Hi
First import from sequential file definitions,at the time of importing select first line is column names and import into datastage,
then in the sequential file , as u already done select firstline is column names and import the table definitions at columns tab,
now the point here is you dont want to set format tab manually, go to sequential file format tab and there import option is there at bottom of that format page, import that file table definitions into format tab, then it will automatically sets the format,
i think the file is fixed length file
Sumati
Pagadrai
Participant
Posts: 111
Joined: Fri Dec 31, 2004 1:16 am
Location: Chennai

Re: How to read the attached file using sequential file stag

Post by Pagadrai »

Hi Sumati,
First step is to understand the file format. Reading from the file
will be pretty easy.
Can you open the file in textpad and see if it has any delimiters?
(comma, space, tab etc)
and are the values enclosed in quotes?
is the file a fixed width?
Also, once you define the fomat and columns tab, you have 'View data'
option there. can you tell what is the error you get there?
Post Reply