Importing data to Sybase, getting "EOF encountered" error

When I try to import this file (1 record):
0261309333170084904400##7#4#34342036       ^84904400##7#4#34342^213027967000002    ^036^026130933317000  }  

Open in new window

I get this error:
executing... /stars/UTIL/bcpin stars1 dent_temp dent_fix.dat
Tue Oct 15 11:10:09 EDT 2013

Starting copy...
Unexpected EOF encountered in BCP data-file.
bcp copy in failed
Tue Oct 15 11:10:09 EDT 2013

Open in new window

The file is generated from a Sql statement on another Unix box and I append "}" to each row in the sql query.

But when I create the file manually with 1 record, it inserts ok . . . So I copy the same data into a blank file without the trailing  }, then simply type in the }, and this loads ok !
executing... /stars/UTIL/bcpin stars1 dent_temp dent_fix_test.dat
Tue Oct 15 11:09:51 EDT 2013

Starting copy...
1 rows copied
Tue Oct 15 11:09:51 EDT 2013

Open in new window

What's going on with this ?

I have another process where I take a flat file and append "}" to the end of each record (via SSIS), so apparently Sybase wants this, but why won't it take my file that I create with } at the end ?

I'm pretty sure I don't need any crazy commands, since the command to load my other process is simply
bcpin2_tilde stars1 CBAS_PROV_IDS CBAS_ID.dat

Plus my command where I successfully imported the one record was
bcpin my_db my_table _my_file.dat
Alaska CowboyAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

This is probably happening because Unix uses a linefeed only for text file line termination and Windows uses carriage return + linefeed.  When converting files to and from Unix on a Sybase SQL server project I worked on previously, we had to strip CR when heading to the Unix world, and add them back in when coming from the Unix world.  We were using a Unix style scripting tools kit called MKTools or something like that which had a TR command to "translate" and we would just TR the file to either strip CR out or change LF to CR-LF depending on which way we went. You may need some kind of file utility to do this. Writing something to do this in VB or C# would be pretty trivial. Or there are a number of shareware file utilities that have this and many more features, like swiss file knife (SFK).

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Alaska CowboyAuthor Commented:
virtuadept, thank you, good info. At least I'm not alone in wrestling with this.

in the meantime, I was able to take my output, run it through SSIS, and add " } " to the end of the record, and then it loaded !

but good info, thanks.
Alaska CowboyAuthor Commented:
good explanation by virtuadept. I used my workaround as explained above as brute force method and I got my data loaded to Sybase.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Sybase Database

From novice to tech pro — start learning today.