We have a legacy system to bring up-to-date because:It uses an unpopular (amoung our users) non-sql database (Btrieve)Provides only a text interfaceIs written in Turbo Pascal (but compiled in free pascal) which is hard to recruit/retain developers to maintain itTo give you an idea of the scale, the code base is 15MB over 756 files.All the studies I've looked in to such as those listed here suggest it is vastly more expensive to rewrite than to adapt what you have.If I thought we could encapsulate the legacy stuff behind a web service and then design new client(s), that would be fine. But I'm stuck with this legacy database which 90% of those 756 files reference.We even attempted replacing the low-level DB code with code to convert to SQL, and while it worked fine, it was too slow because the code is still accessing records one at a time generating far too many SQL statements than it would need. Plus this approach does not allow any improvements in the DB design.When faced with such an upheaval as replacing the DB that is referenced so heavily in code and the other requirements listed, can it still pay to reuse or are we better off treating the new version as a whole new product and just listing the current systems abilities as requirements (bearing in mind no handy requirements doc exists for the current system).I know it's too hard to give a definitive answer on this, so just any advice would be appreciated especially if you've experienced a similar situation.
Software rewriting alternatives
rewrite
Its true that re-writing is the most radical approach and should be avoided whenever possible.  Try to create an intermediate level between your application and the DB. It needn't be a separate project necessarily, but all DB requests should go through it. If you manage to do this first step, it will be easy to change the DB any time, you'll just need to re-write one single module of your project.Once this is done, try to divide your project into small logical pieces and re-write (translate) them one after another (if you really think it can't be avoided). If you have unit-tests, they would be a great help.