Page 1 of 1

how to read BODY data by using sequential file

Posted: Tue Nov 23, 2010 8:48 am
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.

Posted: Tue Nov 23, 2010 8:55 am
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.

Posted: Tue Nov 23, 2010 9:27 am
by chulett
Could you not also declare the three columns and then only pass records where the second (and thus third) columns are populated?

Posted: Tue Nov 23, 2010 9:40 am
by ArndW
Craig's solution is even simpler and more foolproofer :P