how to read BODY data by using 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
ds_dwh
Participant
Posts: 39
Joined: Fri May 14, 2010 6:06 am

how to read BODY data by using sequential file

Post by ds_dwh »

HI,

i have a file , this one look like this

aaaaaaaaaaaaa
bbbbbbbbbbbbbbbbbbbbbb
cccccccccccccccccccccc
col1,col2,col3
10,a,200
21,b,300
23,d,100
ddddddddddddddd
eeeeeeeeeeee
ffffffffffffffffffffffffffffffffffff
kkkkkkkkk

here i want to read valid records
means (col1,col2,col3
10,a,200
21,b,300
23,d,100)
how do this one.
ANJI
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Declare your source file to have just one column, an unterminated VarChar. If "INDEX(In.BigColumn,',',1)" is true then the line has one or more commas and then you can parse the columns using "FIELD(In.BigColumn,",",1)", "FIELD(In.BigColumn,",",2)", etc.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Could you not also declare the three columns and then only pass records where the second (and thus third) columns are populated?
-craig

"You can never have too many knives" -- Logan Nine Fingers
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Craig's solution is even simpler and more foolproofer :P
Post Reply