Fastload File format

Database
Enthusiast

Fastload File format

Hi All,
I have a delimited flat file in the following format, strings are enclosed with in parenthesis. Is it possible to load to the target by chopping the parenthesis(without modifying the source file)? Any Fastload command available?

1,"A00001","XXXX",2007123,100
2,"A00002","YYYY",2007223,300
3,"A00003","MMMM",2007222,400

Kindly advice...
Regards,
Meem
3 REPLIES
Enthusiast

Re: Fastload File format

Oneway to solve your problem is to load the data (with Parathesis) into a temporary table using fastload and then do an Insert-Select into target table .In the select statement, Use trim operator to trim the parathesis at both ends of each field while loading data into target table.
Enthusiast

Re: Fastload File format

Also if you are loading from unix,

you can do a little bit of "seding" and use a named FIFO to load, which won't take any extra space or change your original source file.

here's a template

# create a fifo
mkfifo -m 600 mydatafifo

# tranform data on the fly and send it to fifo as background procss
cat srcdatafile | sed -e 's/^"//' -e 's/","/,/g' -e 's/",/,/g' -e 's/,"/,/g' -e 's/"$//' > mydatafifo &

cpid=$!

# do the fastload from mydatafifo
fastload << END

.... give mydatafifo for file name....

END

rc=$?
if [ $rc -ne 0 ]
then
kill $cpid
fi

rm mydatafifo
Enthusiast

Re: Fastload File format

Thanks joed