Reading problem with Sequential 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
iamnagus
Participant
Posts: 48
Joined: Wed Sep 29, 2004 1:16 am

Reading problem with Sequential file

Post by iamnagus »

I have data in .csv file, this is not fixed width file.

empno should get 1,
sal should get 1,00,000
and deptno should get 11.

how to read this in sequential file stage...

empno, sal, deptno
1,1,00,000,11

Any one Plz Help me....
ameyvaidya
Charter Member
Charter Member
Posts: 166
Joined: Wed Mar 16, 2005 6:52 am
Location: Mumbai, India

Post by ameyvaidya »

Assumption Made:

exactly 3 fields in file. first field is empno, last field is deptno and everything else in the middle is the salary.

Possible Solution:

Read the entire row in as one column: Col1

In a transformer, map 3 columns
EMP<--Field(DSLink2.Col1,",",1,1)
Sal<--Field(DSLink2.Col1,",", 2,Dcount(DSLink2.Col1,",")-2)
Deptno,--- Field(DSLink2.Col1,",", Dcount(DSLink2.Col1,","),1)


Unable to test this though.. No PX available.
Amey Vaidya<i>
I am rarely happier than when spending an entire day programming my computer to perform automatically a task that it would otherwise take me a good ten seconds to do by hand.</i>
<i>- Douglas Adams</i>
balajisr
Charter Member
Charter Member
Posts: 785
Joined: Thu Jul 28, 2005 8:58 am

Post by balajisr »

Better, change your file format. Your file does not seems to be valid for the given metadata.
rager
Participant
Posts: 27
Joined: Tue Jul 17, 2007 11:23 pm
Location: UK

Post by rager »

You would only be able to read this file successfully, without errors, if the you know the length of the empno and deptno field and it is fixed.
I would suggest changing the format of the file.
Post Reply