the independent source of news and information …of bti. fithat™s why we built the solution...

36
and performance of their ODBC solution. Beta testing of the new ODBC drivers should begin in March or April. Anyone interested in acting as a beta site for the Btrieve ODBC drivers should post a message to BTI via CompuServe in the BTRIEVE forum General Information Section, or via Internet to Angie Morales, Beta Site Coordinator, [email protected]. Btrieve Technologies is currently exploring pricing and packaging options for the ODBC drivers. According to Cathy Martin, BTI Public Relations Director, the company is committed to developing a pricing structure that is in line with Btrieve’s licensing model and user expectations. Btrieve Developers Journal January-March 1995 Vol. III No. 1 compatibility functions to future versions of the MicroKernel Database Engine for more performance. According to Doug Woodward, Chief Technology Officer at BTI, the new ODBC interface will share SQL parsing technology with BTI’s Scalable SQL for Windows product. ODBC drivers for Btrieve and Scalable SQL are scheduled to be available in June of this year, concurrent with the projected release of version 6.5 of the MicroKernel Database Engine. In the interim, BTI is working with Q+E/ INTERSOLV to improve the reliability BTI PLANS ODBC SOLUTION Drivers for Btrieve and Scalable SQL to be released mid-year. Austin, Texas — In response to numerous requests from developers, Btrieve Technologies has announced that they are kicking off a project to build high-performance ODBC drivers for Btrieve and Scalable SQL. BTI will address both the design of the ODBC drivers and the design of Btrieve and Scalable SQL engines to achieve maximum performance from its interface. The new ODBC drivers will be designed to take full advantage of new MicroKernel Database Engine features. BTI is also adding engine-level ODBC THE INDEPENDENT SOURCE OF NEWS AND INFORMATION ABOUT BTRIEVE AND SCALABLE SQL INTHISISSUE And much, much more... Photographer:HenrySavage Product Analysis We look at three products: Atlas GIS mapping software from Strategic Mapping, the TapeWare backup system by Rexon Software, and the new Data Direct ODBC Pack from Intersolv....................Page 13 Scalable SQL Why should a Btrieve developer be interested in Scalable SQL? We show you why its time to take a serious look at SSQL......... .......Page 10 Smithware announces plans for Volume II of The SourceBook catalog to be shipped with BTI product packages............................Page 6 The SourceBook II International Focus Btrieve Technologies establishes worldwide channel programs. Novells Database Resellers and Consultants form the foundation of BTIs new Solution Network..............Page 4 The introduction of Scalable SQL from Btrieve Technologies, Inc. marks the first truly portable SQL solution that is Built on Btrieve. Steve Mook and Scott Smith take a look at Scalable SQL from the Btrieve developer’s point of view page 10 Btrieve Accounting, part 2 Eric Cohen’s second in a series of four articles on Btrieve-based accounting looks at low-end accounting systems.............................Page 29 Inside Btrieve Doug Reilly looks at version 6 file structures and presents a utility for salvaging damaged Btrieve files..........................................Page 25 ²

Upload: others

Post on 12-Jan-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: THE INDEPENDENT SOURCE OF NEWS AND INFORMATION …of BTI. fiThat™s why we built the Solution Network Š to give our customers access to the resellers, integrators, consultants and

and performance of their ODBC solution.Beta testing of the new ODBC drivers

should begin in March or April. Anyoneinterested in acting as a beta site for theBtrieve ODBC drivers should post amessage to BTI via CompuServe in theBTRIEVE forum General InformationSection, or via Internet to Angie Morales,Beta Site Coordinator,[email protected].

Btrieve Technologies is currentlyexploring pricing and packaging optionsfor the ODBC drivers. According toCathy Martin, BTI Public RelationsDirector, the company is committed todeveloping a pricing structure that is inline with Btrieve’s licensing model anduser expectations.

BtrieveDeveloper�s Journal

®

January-March 1995Vol. III No. 1

compatibility functions to future versionsof the MicroKernel Database Engine formore performance. According to DougWoodward, Chief Technology Officer atBTI, the new ODBC interface will shareSQL parsing technology with BTI’sScalable SQL for Windows product.

ODBC drivers for Btrieve andScalable SQL are scheduled to beavailable in June of this year, concurrentwith the projected release of version 6.5of the MicroKernel Database Engine. Inthe interim, BTI is working with Q+E/INTERSOLV to improve the reliability

BTI PLANS ODBC SOLUTIONDrivers for Btrieve and Scalable SQL to be released mid-year.

Austin, Texas — In response tonumerous requests from developers,Btrieve Technologies has announced thatthey are kicking off a project to buildhigh-performance ODBC drivers forBtrieve and Scalable SQL.

BTI will address both the design ofthe ODBC drivers and the design ofBtrieve and Scalable SQL engines toachieve maximum performance from itsinterface. The new ODBC drivers will bedesigned to take full advantage of newMicroKernel Database Engine features.BTI is also adding engine-level ODBC

THE INDEPENDENT SOURCE OF NEWS AND INFORMATION ABOUT BTRIEVE AND SCALABLE SQL

IN THIS ISSUE

And much, much more...

Phot

ogra

pher

: Hen

ry Sa

vage

Product AnalysisWe look at three products: Atlas GIS mappingsoftware from Strategic Mapping, theTapeWare backup system by Rexon Software,and the new Data DirectODBC Pack from Intersolv....................Page 13

Scalable SQLWhy should a Btrieve developer be interestedin Scalable SQL? We show you why it�s timeto take a serious look at SSQL......... .......Page 10

Smithware announces plans for Volume II ofThe SourceBook catalog to be shipped withBTI product packages............................Page 6

The SourceBook II

International FocusBtrieve Technologies establishes worldwidechannel programs. Novell�s DatabaseResellers and Consultants form the foundationof BTI�s new Solution Network..............Page 4

The introduction of Scalable SQL from Btrieve Technologies, Inc. marks the first trulyportable SQL solution that is Built on Btrieve. Steve Mook and Scott Smith take a look at

Scalable SQL from the Btrieve developer's point of view � page 10

Btrieve Accounting, part 2Eric Cohen's second in a series of four articleson Btrieve-based accounting looks at low-endaccounting systems.............................Page 29

Inside BtrieveDoug Reilly looks at version 6 file structuresand presents a utility for salvaging damagedBtrieve files..........................................Page 25

²

Page 2: THE INDEPENDENT SOURCE OF NEWS AND INFORMATION …of BTI. fiThat™s why we built the Solution Network Š to give our customers access to the resellers, integrators, consultants and

Phot

ogra

ph by

Dea

n Dix

on

SCOTT A. SMITH, PUBLISHER

Staff

Copyright 1995 by Smithware, Inc.All rights reserved.With the exception of the “Technical Corner” section,this publication is produced independently of BtrieveTechnologies, Inc.No part of this publication may be reproduced in anyform by any means without permission in writingfrom the publisher.Smithware is a trademark of Smithware, Inc.Btrieve and XQL are registered trademarks andScalable SQL, Xtrieve Plus, and MicrokernelDatabase Engine are trademarks of BtrieveTechnologies, Inc.All other names are the trademarkof their respective manufacturers.

From the Publisher...Btrieve Developer�sJournalVolume III, Issue 1ISSN 1071-7463

Published quarterly by Smithware, Inc.

Recently, I was in a meeting in Canada with one of ourOEM partners where I was asked about the relationship betweenSmithware, Inc. and Btrieve Developer�s Journal. I thought thatconversation was interesting enough to share its direction withour entire readership.

The question was, simply put, �Why does Smithware, as aBtrieve tool and add-on vendor and publisher, encourage othercompanies to advertise their competing products in BtrieveDeveloper�s Journal?�

The answer, I think, is quite simple. When Smithware wasfounded in 1988, there was little opportunity for press exposurein the Btrieve market. In fact, while Btrieve had already becomean integral part of the NetWare package, Novell, from the earlydays of the Btrieve acquisition, expressed no interest inmarketing their database products outside of the NetWare arena,and little interest in helping third party vendors succeed.Smithware began publishing Btrieve Developer�s Journal and

The SourceBook Catalog because there was no targeted vehicle for us, as Btrieve tool vendors,in which we could advertise or get the word out to developers about our products. AlthoughBDJ is owned and operated by Smithware, we felt that it was critical to the success of themagazine and catalog, and also important to the Btrieve segment of the industry, that all Btrieveapplication, tool, and service vendors have access to developers through these publications. Notbecause we felt altruistic � we are, of course, in business to make a profit. Including advertisingand information on a wide range of solutions increases the value of BDJ for our subscribers, anda growing customer base means increased sales.

This is my opinion: A rising tide lifts all boats. The more Btrieve applications, add-ontools, and vendors that succeed, the more support we will garner for Btrieve as a product. Assupport for Btrieve grows, we will all share in the increased market for our applications, toolsand services. Competition, it seems to me, is a great thing for all of us. The more tools andsolutions there are available to developers and users, and the greater the number of applicationsthat are �Built on Btrieve,� the more potential customers we will all have.

I again want to encourage all Btrieve application, tool, and service vendors not only toconsider the advertising opportunities that weoffer through Btrieve Developer�s Journal,but also to send us your press releases onyour products and services so that we cangive you the free exposure that yourcompany and your products deserve.

Technical Cornerby Btrieve Technologies..........................................17

Inside BtrieveFurther Inside Btrieve Version 6 Filesby Douglas J. Reilly......................................................25

Accounting SystemsBtrieve-based Accouting Systems part 2by Eric E. Cohen, CPA................................................29

Hands on ReviewLiant�s Relativity ODBC Solutionby Bill Mitchell.................................................................33

Building BtrieveVB TypeConst Utilityby Will Fastie..................................................................37

Advertising

How to Contact BDJ

Publisher: Scott SmithEditor: Steve MookContributors: Eric E. Cohen, Will Fastie,Jim Kyle, Bill Mithcll, Doug ReillyContributors to Technical Corner: LauraAdney, Linda Anderson, Doris Eldridge,Scott Henderson, Diane Klinetob, NancyKromar, Cathy Martin, Rudy McNeese,Chris Ojeda, Mad Poarch, Laurie WisbrunGraphic Design: Arthur AustinDesign Consultant: Tania Owen StudioPhotographers: Dean Dixon, Henry SavageIllustrators: Will Owen, Albrecht DürerAdvertising Manager: Carolyn LightyCirculation Manager: Cindi GourleyAdministrative Assistant: Diane Kugel

Subscriptions

Back Issues: Back issues are available for$20.00 per issue. Contact Cindi Gourley at(615) 386-3100 for additional information.

Annual subscriptions are for four issues peryear at $49/year for delivery inside theUnited States and Canada, and $79/year fordelivery outside the United States.

You may address news items, new productannouncements, tips, advice, comments,complaints, praise, or any othercorrespondence to:Btrieve Developer's Journal2416 Hillsboro Road, Suite 201Nashville, Tennessee 37212Telephone: (615) 386-3100Facsimile: (615) 386-3135CompuServe: 73173,2731Internet: [email protected]

For information about advertising yourproduct or service in Btrieve Developer'sJournal, call Carolyn Lighty, AdvertisingManager, at (800) 685-2403 or (201) 712-0044.

NewsFrom the Btrieve Community...................................4

Book ReviewBtrieve Complete: A Guide forDevelopers and System Administratorsby Jim Kyle............................................................................8

Feature ArticleFinding our Way through Scalable SQLby Steve Mook and Scott Smith.........................10

Product AnalysisTapeWare backup system by RexonSoftware, AtlasGIS mapping softwareby Strategic Mapping, and Intersolv DataDirect ODBC Pack.........................................................13

Contents...

(800) 828-7438 or (615) 386-3100 FAX: (615) 386-3135 Vol III, No. 1 January-March 1995 Btrieve Developer's Journal 2

Page 3: THE INDEPENDENT SOURCE OF NEWS AND INFORMATION …of BTI. fiThat™s why we built the Solution Network Š to give our customers access to the resellers, integrators, consultants and

BTI Establishes Worldwide Channel ProgramsNovell�s Database Resellers and Consultants Form the Foundation of BtrieveTechnologies� Solution Network

cities throughout the world. For moreinformation regarding the trainingseminars and the Btrieve Technologies�Solution Network programs, contact BTIat 800-BTRIEVE or 512-794-1719.Faxes can be sent to 512-794-1778 andCompuServe users can contact BTI on theBTRIEVE forum.Austin, Texas — Btrieve

Technologies has announced the formationof their new Solution Network, acomprehensive set of channel partnerauthorization and certification programsdesigned to provide resellers, integrators,consultants, and independent softwarevendors (ISV�s) with the products,training, sales tools, and support requiredto deliver complete database andinformation management solutions.

�We know that expertise in theimplementation of networked databaseswill often make the difference between adatabase application that simply collectsdata and an information managementsystem that truly allows a company to usecorporate information as a competitivetool�, said Ron Harris, President and CEOof BTI. �That�s why we built the SolutionNetwork � to give our customers accessto the resellers, integrators, consultantsand ISVs who have this expertise.� A keyfactor that will contribute to the success ofBTI�s channel partners is the enormousnumber of business applications in theworld today based on BTI�s databasetechnology.

�Network and databaseintegrators can quickly deliver powerfulsolutions to customers using anapplication, such as an accounting system,as the base and then complete the solutionwith custom-developed modules or verticalapplications built on BTI�s engines�, saidDomenic Santini, Founder and VicePresident of Trivium Computer Systems,Inc.

BTI�s worldwide channel partnerauthorization efforts will focus on themany resellers of NetWare who activelysell Btrieve and Scalable SQL. Since thetransfer of the database technology fromNovell to BTI in April of 1994, resellersauthorized by Novell have continued toaggressively sell the products throughoutthe world. As a participant in the SolutionNetwork program, these resellers andintegrators will gain access to key programbenefits including: qualified leads andreferrals for products and services; priorityproduct support; database development,integration and management training;

demonstration software; access to pre-release software; joint executive briefingsfor key customers; joint marketing andsales opportunities; and product literatureand sales tools.

Starting in March 1995, BTI willoffer a free 1 and 1/2 day initialauthorization training seminar in major

²

For more information on theBTI Solution Network, seepage 20-21 in this issue's

Technical Corner123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012

Page 4: THE INDEPENDENT SOURCE OF NEWS AND INFORMATION …of BTI. fiThat™s why we built the Solution Network Š to give our customers access to the resellers, integrators, consultants and

SourceBook and Btrieve Developer’sJournal. “They have immediate exposureto active Btrieve developers at animportant moment: when they are buyingproducts.”

In addition to being part of the newBTI product packaging, a copy of thecatalog is mailed to all names on theBtrieve Technologies registered users list.For more information on having yourproduct or service included in this editionof The SourceBook, contact CarolynLighty at (800) 685-2403 or (201) 712-0044, or FAX (201) 712-9157.

Smithware to Publish The SourceBook, Volume IIBTI�s Product Packaging to Contain new Catalog of BtrieveCompanion Products and ServicesNashville, Tennessee — Smithware, Inc.,the publishers of Btrieve Developer’sJournal, has begun planning thepublication of Volume II of TheSourceBook, a catalog of Btrieve andScalable SQL add-on products and serviceproviders. Since August 29, 1994, eachproduct package shipped by BtrieveTechnologies has contained a copy of TheSourceBook.

“Obviously The SourceBook is thebest place for a Btrieve add-on tool vendoror service provider to be,” said CarolynLighty, advertising manager for The

Crystal AnnouncesInternationalVersionsVancouver, BC — Crystal Servicesannounced that its Crystal Reports 4.0will be available in French and Germanby the end of March, 1995.

�We are totally committed to ourinternational market,� said MichelMontandon, Crystal�s Director ofInternational Sales. �By making Crystalavailable in French and German, we areable to provide the benefits of our productto a much larger group of users.�

Crystal Reports 3.0 is currentlyavailable in Borland�s dBase for Windows4.0 in Dutch, French, German, Italian,Portuguese and Spanish, and will soon beavailable in Czechoslovakian andRussian.

AG Tech Corporation in Japancurrently has Crystal Reports 2.0available in Japanese and is working torelease version 4.0. Questar SRL in Italywill soon have an Italian version ofCrystal Reports 4.0.

Crystal Services reports havingshipped over 600,000 copies of theiraward-winning reporting tool since itsintroduction in 1992. Their product lineincludes the Crystal Reports Standard,Crystal Reports Professional, and CrystalReports Server editions. Contact CrystalServices at (604) 681-3435.

Btrieve Libraries for FoxPro and Clipper AvailableCommunication Horizons Regains Control of Product LineStamford, Connecticut —CommunicationHorizons will resume publication of theirproducts RaSQL Btrieve RDD for Clipperand RaSQL Btrieve Library for FoxPro,which since mid-1991 have beenpublished by Pinnacle Publishing Inc.

Pinnacle mailed a letter in lateNovember to all RaSQL users informingthem of the news. Pinnacle will continueto support current users through April of1995. Communication Horizons, whichdeveloped the RaSQL products, willsupport new users and all registered usersafter April. Pinnacle will continue topublish another Communication Horizonsproduct, NetLib.

Neil Weicher, president ofCommunication Horizons, said, �We are

energized by the new vitality BtrieveTechnologies, Inc. has given to theBtrieve marketplace. We have beensaying for years that Btrieve was the bestplatform for mission-critical applicationswhere data integrity, portability, andperformance on a network wereparamount.�

Communication Horizons have beenproducing LAN and connectivity tools forClipper and FoxPro since 1988. ItsNetLib product was selected as �BestNetworking Library� by readers ofDataBased Advisor magazine for fiveconsecutive years. ContactCommunication Horizons at (203) 324-0448.

²

²

New Tool Available forBtrieve Import/Export

between Access, FoxPro, Btrieve,Paradox, dBase, ASCII, Excel, and Lotusformats.

Product pricing ranges from $89 forthe Standard Edition to $495 for theVBX/Developer�s Kit, which includes a10-user runtime license (an unlimited,royalty-free license is available for anadditional $295). For more informationcontact Innovative Solutions &Technology at (417) 781-3282.

Joplin, Missouri — Innovative Solutions& Technology (IST) announced their newOpenExchange VBX/Developer�s Kit 1.0,which combines the company�s dataimport/export application OpenExchangePRO 1.5 with a VBX interfacecompatible with Microsoft Visual Basic,Visual C/C++, and PowerSoft�sPowerBuilder. The OpenExchangeapplication uses the Microsoft Jet 2.5database engine to import or export data

²

Briefly Noted

²

Btrieve Technologies (512-794-1719)has moved their offices to 8834 Capital ofTexas Highway North, Suite 300 Austin,Texas 78759. Phone and FAX numbersremain the same. CYMA Systems, Inc.,(602-831-2607) of Tempe, Arizona, isshipping Client Accounting, the latest inthe PAS family of products. CYMA alsorecently signed an agreement with LytecSystems, to distribute Lytec�s line ofmedical and dental software throughcertified CYMA Healthcare dealers.Solomon Software, (419-424-0422) ofFindlay, Ohio, has released three newmodules for its Solomon III for Btrievesystem. Addison-Wessely (617-944-3700) will publish in May 1995 a newbook entitled Btrieve Complete: A Guidefor Developers & System Administratorsby Jim Kyle. The price will be $39.95and includes a utility diskette. See page 8of this issue for our review.

4 Btrieve Developer's Journal Vol III, No. 1 January-March 1995 (800) 828-7438 or (615) 386-3100 FAX: (615) 386-3135

Page 5: THE INDEPENDENT SOURCE OF NEWS AND INFORMATION …of BTI. fiThat™s why we built the Solution Network Š to give our customers access to the resellers, integrators, consultants and

control offers more than 50 properties toVisual Basic applications forcomprehensive control over runtimeparameters, while the DLL offers similarcapabilities to C/C++ applications. R&Rwas selected by Solomon Software forgenerating production reports directly fromSolomon IV Windows-based client/serveraccounting software, written in VisualBasic.

Other version 6 enhancements includeshortcuts for creating automatic andconditional totals, new publishingcapabilities such as snaked columns andAvery labels, export to database andworksheet files, distribution of reports viae-mail, the ability to document reportdesigns by adding comments, newcalculation functions, and additionalruntime parameters.

R&R Report Writer Version 6 forWindows is available in two editions,Xbase Edition and SQL Edition. Upgradesfor all registered R&R users are $99 forthe Xbase and $149 for the SQL Edition.The suggested retail price is $249 for theXbase Edition and $395 for the SQLEdition.

Contact Concentric at 508-366-1122.

to more than 25 database formats,including desktop and client/serverdatabase managers. In addition, users canconnect R&R to any database that providesan ODBC-compliant driver.

R&R includes a Report Dictionary andReport Templates, allowing developers tocreate views of a database that will beeasier for end users to understand, and alsoprovides data security above and beyondthat provided by the underlying databasemanager.

R&R now includes Report Wizards forcreating columnar reports, mailing labels,and group-break reports. Users can select aWizard from a gallery of report layouts andthen receive step-by-step instructions,resulting in a finished report.

For interactive manipulation of reportdata, R&R now supports integration withMicrosoft Excel version 5.0 using OLEAutomation. R&R can build pivot tablesfor multi-dimensional data analysis, drill-down, and production of crosstab reports.

R&R is also accessible through VBXand DLL interfaces, providing flexibilityfor integrating R&R into Visual Basic, C/C++, Microsoft FoxPro and otherprogramming environments. The VBX

CONCENTRIC SHIPS R&RREPORT WRITER VERSION 6FOR WINDOWSWestborough, Massachusetts �Concentric Data Systems, Inc. hasannounced the release of R&R ReportWriter Version 6 for Microsoft Windows.New and updated features help developersand end users customize R&R, integrateR&R with other Microsoft Officeapplications, and embed R&R reports intoapplications created with Microsoft VisualBasic and C/C++.

R&R Version 6 is Microsoft OfficeCompatible. R&R provides data access andreporting for creating a range of custommanagement reports, business forms andfinancial statements, as well as ad-hocqueries. Office features such as Wizards,ToolBars, ToolTips, and Short-cut Menushave been added to R&R to minimizetraining and to integrate R&R with Officeapplications.

R&R Report Writer SQL Edition nowincludes Open Database Connectivity(ODBC) database drivers to enable access ²

Novell and BTI Issue Statement of Directionon their current support for SFT III. Bysupporting Novell�s SMP and NDS, BTIwill not onlyexpand it�s relationship with Novell, butwill also continue to provide users withthe most scalable, robust datamanagement systems available. BTI�spartnership with Novell will continue toplay a key role in the delivery ofinformation management solutions.

Due to product release schedules,Novell and BTI were unable to provideversion 6.15 as a component of theNetWare operating system. However,with the next release of NetWare, it isboth Novell and BTIs� intention toprovide the latest version of Btrieve 6 asan integral component of the NetWareoperating system.

In an effort to keep NetWarecustomers up to date with the latesttechnology, BTI will begin a marketingcampaign to provide NetWare customerswith a means for obtaining the latestNavigational database technology: Btrievev6.15 NLM.

Provo, Utah � As the pioneer andleading provider of a premier networkoperating system for database systems,Novell has been shipping the Btrievedatabase as a component of NetWaresince 1987. NetWare became the firstnetworking operating system to ship acomplete database management system(DBMS) and Btrieve was the DBMSchosen. The combination of NetWareand Btrieve has provided true Client/Server solutions for customers.

Since the formation of BtrieveTechnologies (�BTI�) in April of 1994,BTI and Novell have continued to developtheir strategic relationship.

On December 6, 1994, BTIannounced, in parallel with Novell, thatthey will be shipping an upgraded versionof Btrieve for NetWare, version 6.15, thenavigational Client/Server database. In arelated announcement, BTI revealed plansto support Novell�s Symmetric MultiProcessing (�SMP�) and NetWareDirectory Services (�NDS�) in futureversions of Btrieve for NetWare, building ²

Briefly NotedThe Btrieve Technologies (512-794-1719) 1995 User Conference has beenscheduled for October 23-25 and willbe held at the Stouffer Austin Hotel inAustin, Texas. To be placed on theconference mailing list, email yourrequest to Laurie Wisbrun([email protected]).Reservations should be made directlywith the hotel by September 29th. Tomake reservations, call 512-343-2626and mention �Btrieve� to receive thespecial room rate. BtrieveTechnologies also is in the process ofpublishing a directory of Btrieveapplications and tools. The directorywill be used in joint marketing efforts,direct mailings, at industry events, andby resellers. A product profile form isavailable on the Btrieve CompuServeforum library 10 or by calling BTI at512-794-1719. The directory will beavailable in Spring 1995 and thematerials deadline for the first releaseis March 17th. The Btrieve forWindows NT version 6.15 beta is nowavailable on CompuServe. BtrieveDeveloper�s Journal text is nowuploaded in the Reference Shelf libraryof the Btrieve CompuServe forum.

(800) 828-7438 or (615) 386-3100 FAX: (615) 386-3135 Vol III, No. 1 January-March 1995 Btrieve Developer's Journal 5

Page 6: THE INDEPENDENT SOURCE OF NEWS AND INFORMATION …of BTI. fiThat™s why we built the Solution Network Š to give our customers access to the resellers, integrators, consultants and

Btrieve Complete: A Guidefor Developers and SystemAdministratorsBy Jim Kyle, Author

Editors Note: We were so excited about the upcomingpublication of Btrieve Complete that we decided to starttalking about it even before we could get a copy toreview. This article is a summary, by the author, ofhow this new Btrieve book came into being andcontains some excerpts from the introduction of thebook. Since the publication date is set for May 1995,we will present a complete review in the next issue ofBtrieve Developer�s Journal.

Btrieve Complete (ISBN: 0-201-48326-2) will be availablein May 1995 from Addison-Wesley. Check your localbookstores or call 617-944-3700.

Copyright (c) 1995 by Jim Kyle. This excerpt is published byspecial arrangement with Addison-Wesley PublishingCompany and may not be reproduced in any form withoutexpress written permission from Addison-Wesley PublishingCompany.

Btrieve Developer�s Journal has asked that I tell some ofthe background of how my latest book, Btrieve Complete, cameto be written. I don�t think they really wanted all thebackground, though. That would cover a time span of more than40 years, since my first published article in a national magazine!

Up until early 1990, my awareness of Btrieve was aboutlike that of most computer users and non-database-orientedsoftware developers. In other words, I knew it existed, but hadno dealings with it personally. What little I thought I knew aboutit (most of which turned out to be totally wrong) convinced methat it was something I would probably never have any use for,so I happily continued to program my favorite systems tools.The occasional database consulting job that came my way couldalways be handled adequately with either Clipper�s Summer �87version, or with FoxBase Plus (this was before FoxPro camealong!).

But then my nearly-25-year association with a majormanufacturer of mainframe peripherals came to an end in a

flurry of downsizing, and my �fallback job� was with a smallsoftware firm that had built its flagship products on Btrieve as afoundation. While my own projects had no need for Btrieveoriginally, the people I worked with every day used it and likedit. Talking with them opened my eyes to just how distorted myperception of the package had been!

The initial release of my first major project used ahomebrew indexing technique, largely because our company hadbegun a policy of using only those third-party products forwhich we could obtain the source code. But within only a fewmonths after first shipment of the product, the tech support loadmade it obvious that my homebrewed indexing was the weakestlink in the chain.

The other developers kept suggesting that I rewrite that partof the product to use Btrieve (which was an exception to thesource-code-only rule since everyone else had used it for somany years). I finally decided to at least give that a try, becausenothing could be much more difficult than to try to patch up theoriginal bungled design!

If I�ve had any success at all as a developer of software andan explainer of things technical, I owe much of the credit to thefact that I�m what is known in show business as �a quickstudy.� Given a new project, if I can get hold of three or fourgood books providing all the necessary details, I can usually beup to speed and productive within four to six weeks at theoutside. I had already done this a few months earlier. Virtuallyall my prior experience had been with character-mode toolbuilding at the DOS level, but the new project was a system thatstored electronic images of documents (much like FAX images)and recovered them on demand. Having become competent withthe pure-graphics interface almost overnight, I had no doubt thatI could learn Btrieve easily.

So I hied myself off to the bookstores to grab a handful ofreference books.

And after several daysof searching every technicaloutlet in town, I went backto the office, empty handed!At that time not a singlebook dealing with Btrievewas listed in any publisher�scatalog. I was even willingto settle for �Btrieve forDummies� as a startingpoint, but no such luck. (Itstill doesn�t exist so far as Iknow.)

As a last resort, Idialled into CompuServe,joined NetWire, andsearched out the sectiondealing with Btrieve. I found several quite knowledgeable folksthere, and I learned that no definitive book on the subjectexisted (although one was said to be in preparation).

The official Novell manuals weren�t much assistance to meas a beginner, because their viewpoint was based on referenceneeds rather than the tutorial approach. Simply getting the ideaof the key number and the roles played by the key buffer tookme far too long, but with the help of the CompuServe forum

See Book on page 40...

6 Btrieve Developer's Journal Vol III, No. 1 January-March 1995 (800) 828-7438 or (615) 386-3100 FAX: (615) 386-3135

Page 7: THE INDEPENDENT SOURCE OF NEWS AND INFORMATION …of BTI. fiThat™s why we built the Solution Network Š to give our customers access to the resellers, integrators, consultants and

Finding our Way ThroughScalable SQLBy Steven Mook and Scott Smith, Smithware, Inc.

First impressions

For a couple of guys who are used to taking our dataone record at a time, picking our indexes carefully, andchecking our code for NULL pointers with a fine-toothedcomb, the arrival of Scalable SQL boxes in the office was aan event. First off, the boxes are big and heavy, theirweight attributable to a substantial set of manuals detailinginstallation and operation, SQL language reference, andstatus codes and messages. Second, the boxes are pretty(see cover picture). And third, the boxes contained SQLrelational database engines, with which we were onlyvaguely familiar.

We first installed the Scalable SQL for Windowsdiskettes on a machine running both the Btrieve Client andNetWare Btrieve requester engines. Installation wasstraightforward, and took about four minutes, whichincluded filling out the registration information. Theprogram group caused us a bit of a scare. It contained twohelp files and three executables, only one of which, SQLScope, appeared to accomplish anything tangible.

For the benefit of those among our readers who findthemselves toying with the idea of moving from good oldfashioned Btrieve programming to something more envogue, it’s important to keep a couple of things in mind.Structured Query Language is a paleolithic technology, acommand-line-syntax-based holdover from the era of bell-bottom polyester slacks and VW microbuses. There isnothing pretty or modern about the concepts or theinterface. Only the most obdurate aficionado of mainframedata processing could possibly love it. But Scalable SQLprovides some real advantages, especially in a networkenvironment. One is declarative relational integrityenforcement at the MicroKernel level. Another is trueclient/server database processing, with all data-gathering

operations handled at the server. Yet a third is easyintegration into an ever-increasing number of rapidapplication development systems, report writers, andexecutive information systems designed to support SQLdatabases.

With the introduction of the Scalable SQL product line,BTI has opened the way for serious applicationdevelopment using a true relational database engine todevelopers who need the kind of platform independenceoffered by Btrieve. The Scalable SQL products are similarin architecture to the old NetWare SQL. The difference isthat with Scalable SQL, developers can create and run SQLapplications on stand-alone Windows platforms, peer-to-peer networks, NetWare client/server environments, and,coming soon to the shelf of a BTI Channel Partner nearyou, DOS and Windows NT Server as well.

Finally, don’t forget that a database paradigm that setsthe standards today may not be around tomorrow, andwe’ve already established that SQL is getting a little longin the tooth. With their MicroKernel architecture and theirfocus in desktop and network hardware, BTI is probablythe best positioned of all the major database vendors totake advantage of new and emerging databasetechnologies.

Scalable SQL is small

Two diskettes. Three if you count the registrationdiskette which goes in the postpaid disk mailer after theinstallation, to register your product with BTI. That’s whatit takes to install the Scalable SQL for Windows product onone machine, including the Btrieve for Windows ClientEngine. If you’re installing Scalable SQL for NetWareServer Edition, two diskettes. The Scalable SQL forWindows Developer’s Kit, on the other hand, requires (youguessed it) two diskettes. The files for the Windowsedition, including drivers, utilities, and help files, are goingto chew up a whopping two and one-half meg of yourprecious hard disk space.

Scalable SQL is fast

As fast as SQL can be, Scalable SQL is. Let’s face thefact that you’ve got to define reasonable index paths foryour data if you’re going to need to get it back quickly. Todevelopers who have worked with indexed recordmanagers, this is not news. Much of the optimization ofany database process takes place in the process of databasedesign. Ad-hoc queries on complex joins of large fileswhich cannot be optimized by indexed lookups are going totake a long, long time. But Scalable SQL utilizes Btrieveextended operations to help keep your hourglass-watchingto a minimum.

7 Btrieve Developer's Journal Vol III, No. 1 January-March 1995 (800) 828-7438 or (615) 386-3100 FAX: (615) 386-3135

Page 8: THE INDEPENDENT SOURCE OF NEWS AND INFORMATION …of BTI. fiThat™s why we built the Solution Network Š to give our customers access to the resellers, integrators, consultants and

A sample query on the non-indexed city field of a largemailing list file, SELECT name, zip_code FROMmailing_list WHERE city = ‘NASHVILLE’, ran 48 minutesusing Microsoft Query in conjunction with the MicrosoftODBC Desktop Driver version 1.0 for Btrieve, 21 secondsusing SQL Scope and Scalable SQL. SQL scope returnedonly the 7 records which it displayed, paging down tookanother 20 seconds or so. We also tried Microsoft Queryinterfaced to Scalable SQL using INTERSOLV DataDirectODBC driver, which returned the record set in just underthree minutes.

Just for comparison, we also tried SELECT name,zip_code FROM mailing_list WHERE zip_code = ‘37212’,zip_code being an indexed field. Once again, 48 minutesfor the file scan courtesy of ODBC Desktop Driver 1.0,instantaneous results from Scalable SQL, both using SQLScope and Microsoft Query (when your first runner-uptakes nearly an hour, it seems silly to count processor clockcycles).

Scalable SQL is a complete relationaldatabase engine

The relational database paradigm is not the solution toall of the world’s problems, but it has applications in thetypes of tasks for which Btrieve has historically been used.Accounting and business information systems, forexample, tend to be structured relationally. Customer fileslink to transaction files, which link to lookup tables, etc.Using a true relational database management system likeScalable SQL for such applications can simplify andstructure the gathering and updating of information fromrelated tables, and can help to insure the relational integrityof the data.

For developers used to working Btrieve, Scalable SQLwill require a certain amount of re-orientation. SQL syntaxcan quickly become convoluted, especially when acomplex data operation is involved. For example, tryimagining how one might create a view on a customer list,joined to a list of payment transactions and a list of chargetransactions, limited by date range to those customers whohave transactions in either transactions list, in order tocreate a customer statement. Fortunately, Scalable SQLreference manuals are very comprehensive. Unfortunately,the only interactive data tool supplied with Scalable SQLfor Windows, SQL Scope, combines all the worst interfacefeatures of Microsoft Query with the on-line help availablefrom BUTIL.EXE. The Developers Kit providesprogrammers with the interface to make direct calls to theScalable SQL engine, but we very quickly opted to add ahigher-level front end using Microsoft Access and theINTERSOLV DataDirect ODBC drivers.

Scalable SQL is Built on Btrieve

Every SQL database has something underneath it tohandle the physical storage and retrieval of records.Scalable SQL uses the Btrieve MicroKernel DatabaseEngine. Which means that in most cases, legacy data won’thave to be ported to a new format, and legacy applicationswill continue to function normally. It also means thatScalable SQL inherits Btrieve’s reputation forcompactness, speed, and dependability. And it meansinstant data-level compatibility with most modularaccounting packages and mission-critical Btrieve systems.In short, Scalable SQL is right at home on top of most ofthe critical business data currently stored on PC’s andLAN’s.

Scalable SQL can work alongside typicalBtrieve applications

Like most offices, ours has a set of mission-criticalsystems which evolved over time can’t be easily or quicklyreplaced. With Scalable SQL, we have the option to addnew SQL-based modules and replace older modulesgradually, without disturbing our existing Btrieveapplications. Some applications, of course, will have to bemodified in order to port the data to Scalable SQL. EveryBtrieve programmer has at least one of those reallyinventive programs which use brilliant, unique, absolutely-no-way-to-explain-this-in-a-DDF storage schemes. But thechanges will generally be minor, and can be implementedone by one, without requiring wholesale conversion of thedata files or an abrupt change-over between systems.

Scalable SQL is a natural fit for ODBC

What is ODBC anyway? We sometimes get theimpression that only about a quarter of the people who tellus it’s critically important that they have it, actually knowwhat it is. ODBC is a Microsoft specification for acommon call level API for Windows, which performsSQL-syntax operations on database files. ODBC driverscome in two flavors, the first being the kind that processSQL instructions internally, and performs file-leveloperations to retrieve data; the second being the kind thatsend SQL instructions out to an SQL database engine forprocessing, and reformat the returned data before passing itback to the application.

Now, here’s where it gets complicated, so please, try tobear with us through a hypothetical situation. Let’s justsuppose we have some Btrieve files holding our data.We’ve got money to burn and a couple or three years to killin development time, so we decide to write the mother ofall ODBC drivers to allow us to access our Btrieve files.We start by defining our data in a data dictionary, since

(800) 828-7438 or (615) 386-3100 FAX: (615) 386-3135 Vol III, No. 1 January-March 1995 Btrieve Developer's Journal 8

Page 9: THE INDEPENDENT SOURCE OF NEWS AND INFORMATION …of BTI. fiThat™s why we built the Solution Network Š to give our customers access to the resellers, integrators, consultants and

Btrieve doesn’t store information about the field structureof its files. Then we add code to implement data typetranslation, indexed record access, ad-hoc query support,and relational integrity enforcement. A year or so and acool million over budget, and, eureka! We’ve just re-invented Scalable SQL for Windows. Except that therelational integrity and data security enforcement we’ve socarefully implemented is sitting up at the driver level, notat the file manager level, so any ill-behaved applicationwith a half a mind to do so can come in behind us andscrew everything up.

Finally, on top of all that, we layer on an API to move

the data to and from our application in strict adherence tothe ODBC API compatibility specification. Which, onceagain, has already been done for us by the good people atQ+E/INTERSOLV, who have an ODBC driver for whatused to be called NetWare SQL. Works just dandy withScalable SQL for Windows or Scalable SQL for NetWare.Why act like a defense contractor when the best return onODBC you’re likely to find anywhere is available today,off the shelf?

Scalable SQL PerformanceScalable SQL is an obvious choice as aBtrieve back-end to ODBC-enabledapplications. We used theINTERSOLV DataDirect ODBC Packversion 2.0 to attach Scalable SQL forWindows to Microsoft Access. At leftis a query design view showing asample query on a large data set,joining two tables. Thecustomer_database table contains over40,000 rows and weighs in at about 40meg. The order_header table containsover 9,000 rows, related to thecustomer_database by a 4-byte integerkey. The database was not originallydesigned using SQL, but representslegacy Btrieve application data.

The transition from Query Designview to Table view in Microsoft Accesswas dramatic, to say the least. Thedata resides on a NetWare serverrunning Btrieve for NetWare 6.10, butthese results were obtained fromScalable SQL for Windows single-station installation, not the ScalableSQL for NetWare NLM, which,presumably, would have resulted inbetter-optimized performance. Wewould have liked to have run acomparison between these results andthe results obtained from Access usingthe standard Access engine, butseriously, who has that kind of time?

9 Btrieve Developer's Journal Vol III, No. 1 January-March 1995 (800) 828-7438 or (615) 386-3100 FAX: (615) 386-3135

²

Page 10: THE INDEPENDENT SOURCE OF NEWS AND INFORMATION …of BTI. fiThat™s why we built the Solution Network Š to give our customers access to the resellers, integrators, consultants and

Cruise Control automatic server backup scheduling system.One particularly nice feature of TapeWare is the fact that

it does a great job of recognizing that Btrieve is loaded on theserver and setting itself up accordingly. To backup Btrievefiles, you simply create a file called TW$BTRV.DAT in theSYS:\SYSTEM directory of the server that contains theBtrieve files. There is a clearly defined structure for the filewhich includes a Btrieve File Set Name (Accounting Files, forexample), a file logical name (such as GL_HEADER) and aphysical file name with NetWare directory location. Once thislist is created, the Cruise Control system (that automaticallybacks up the server on a daily basis) knows to enablecontinuous operations on each file in the list before backing up

the file.We only had a fewproblems with TapeWareand all were solved quicklyby the Rexon technicalsupport department. Themain thing to remember,when using any backupsystem that uses continuousoperations to backup openBtrieve files, is that all of theBtrieve files must be version6 files. In TapeWare, aninvalid Btrieve status on anyfile in a backup set causesall other files in the set to beskipped. The first file in ourset happened to be an old

version 5.x file that we had not yet converted. WhenTapeWare encountered an invalid status on attempting to setcontinuous operations on this file, it returned a non-descriptive“Btrieve error: Invalid status opening Set” and none of the fileswere backed up. After a little bit of conversation with a goodtechnical support department (we even talked to the Btrieveexpert on the project) the problem was discovered. Weconverted the file in question to Btrieve version 6 and all hasworked well ever since.

While talking with the technical supports representativesat Rexon, we learned that the company is very committed tocontinuing strong support for Btrieve on all platforms includingNetWare, Windows, Windows NT, OS/2 and LAN Server.

With this issue of Btrieve Developer’s Journal, we begina new regular feature called “Btrieve Product Analysis.” Ineach subsequent issue of BDJ, we will be focusing on severalproducts of interest to the Btrieve community. Someinstallments will focus on several products in one particularcategory (similar to our Report Writer Roundup in Volume II,Issue 1. Others, as in this issue’s case, will contain a numberof products from dissimilar areas.

In this issue, we present our review of three variousproducts. First, we were interested in finding a solution toneed in the BDJ office for an on-line NetWare-based backupsolution that would backup Btrieve version 6 files while theywere in-use on the server. Rexon Software’s TapeWareNetwork Archival Software fit the bill perfectly. And then welooked at AtlasGIS Mapping Software from StrategicMapping to generate several maps of our readership.

TapeWare NetworkArchival System

If you are even a passive browser of the BTRIEVEforum on CompuServe, then you had to have seen all of thecomments about several users’ frustrating experiences withbackup systems that claim the ability to automatically backupBtrieve v6 files. We have found what we believe to be thebest solution: Rexon’s TapeWare Network ArchivalSoftware.

We cannot be sure whether it is as a result of thesoftware, or as a result of the Hewlett-Packard JetStore 5000Digital Audio Tape (DAT) backup device and the Adaptec1520a SCSI card combination, that installation was a snap.Although we suspect it was a little of both, we cannotremember when an installation went so smoothly. It took onlyabout 45 minutes from typing DOWN on the server to havingTapeWare up and running on the JetStore 5000.

Once installed, we were able to easily backup not onlyNetWare volumes, but also any local hard drives attached tothe NetWare network. Although the software is DOS-based,we had no trouble running it from a DOS box in Windows andthe software claims OS/2 compatibility. TapeWare has a taperotation scheme built into the product which is a part of their

Rexon Software'sTapeWare backup systemis a great way to backup

Btrieve version 6 fileswhile they are in use

Product Name: TapeWare Version: 4.2Manufacturer: Rexon Software, Inc.Address: 2750 North Clovis Ave., Suite 126Fresno, CA 93727Telephone: 800-228-9236 or 209-292-8888FAX: 209-292-8908

(800) 828-7438 or (615) 386-3100 FAX: (615) 386-3135 Vol III, No. 1 January-March 1995 Btrieve Developer's Journal 10

²

Page 11: THE INDEPENDENT SOURCE OF NEWS AND INFORMATION …of BTI. fiThat™s why we built the Solution Network Š to give our customers access to the resellers, integrators, consultants and

Finally, we can say something good about an ODBC driverfor Btrieve. Actually, there are several good features of theINTERSOLV DataDirect ODBC Driver Pack, version 2.0 forBtrieve. It provides full support for ODBC version 2. The driversupports transaction processing using standard SQL Commit andRollback syntax. The performance returned on queries seems tohave been improved. The driver pack also provides the abilityto add definitions for existing Btrieve files to a DDF set from adialog box interface in the ODBC Administrator in WindowsControl Panel.

Having said that, there are a few things what will get you ifyou don�t watch out. For example, defining tables using theODBC Administrator option will take liberties with yourexisting database definitions. Nothing was mentioned in thedocumentation about the case of table names, but the definitionprocess changed them to all-uppercase in my existing DDF.Perhaps the one thing Btrieve developers find most irksomeabout working with any of these higher-level interfaces is this �I

didn�t tell it to do that!�syndrome, which seems tomanifest itself most often whenone tries to connect to a large,critical database. The nextgreat breakthrough in ODBCtechnology, I predict, will bethe Cancel button.

The other peculiarbehavior I noticed involvedattempting to run the samequery we ran with the ScalableSQL data source in MicrosoftAccess (see Scalable SQLPerformance on page 12). Theidentical Select statementwhich worked with the

Scalable SQL interface, caused the Btrieve driver to return theerror �Field Not Found.� Creating a query-by-example inMicrosoft Query finally worked after a couple of false starts(relapses of the �I Didn't Tell It To Do That!� syndrome), butcutting and pasting the resulting SQL syntax back to Access didnot. Go figure. Meanwhile, MS Query was off in whatever limbothese programs enter while awaiting word from the data source,which arrived about half an hour later.

The last caveat I�ll toss out is that installation of the single-driver license pack, retail price $99.00, is a one-shot deal. Thedriver pack gives you two options for Btrieve data access,Btrieve, and the mis-labeled NetWare SQL. Please be sure tolook at the article on Scalable SQL before installing one or theother.

DataDirect ODBC Pack

Finally, we can saysomething good about anODBC driver for Btrievebut there are a few thingswhat will get you if you

don�t watch out.

Back in the early days of Smithware when we were locatedin a spare bedroom, we had a US map and a World map wherewe would place a stick pin for each Btrieve tool that we shipped.As a few years passed, we not only grew tired of rubbing blisterson our thumbs, but we also ran out of time. Those maps nowhang on our office walls as a pleasant reminder of simpler daysgone by.

When we learned that AtlasGIS, the mapping software fromStrategic Mapping, supported data stored in Btrieve files, we justhad to take a look at it. On installation, you realize that the USis a very large place. And the diskettes or CD�s (and hard diskspace over 25MB) needed to store AtlasGIS and thedocumentation that comes with it are almost equally as large.This application was one of the first applications that we hadseen developed with the AppWare foundation from Novell. Thisgives AtlasGIS a few quirky interface features. But like most GUIfeatures, the more you walk on it, the less it sticks to your shoe(or the easier it is to use).

AtlasGIS does all of its internal database manipulation usingDBase files. Therefore, ODBC (a version of the Intersolv version1.0 Btrieve driver is included with the package) is used toimport data into Atlas� internal DBase file structure. For ourpurposes, we wanted to display the Smithware customer databaseand mailing list file on a US map. Since this file has over 50,000

records, and we allknow the performanceof Btrieve ODBCdrivers in their currentstate, importing themtook a while. But itwas not that bad: about20 minutes. Once theZIP codes from thedatabase wereimported into an Atlastable, we were able toGeo Code each record.Geo Coding takes theZIP code populatesfields that are used to

place each record on the map. Once the data was Geo Coded, weloaded a predefined US map, the State and County boundaries,and then the data itself. Finally we could see our distributionconcentration by region around the country without sorethumbs.

Since AtlasGIS requires that the Btrieve data be imported, itis not truly an on-line solution, but it is, however, a great one. Ifyou want to see your Btrieve data on a map, this product willcertainly be a good addition to your Btrieve data analysis tools.

AtlasGIS

Putting a dot on the mapfor each data point is easy,

doing much else with ittakes a bit of study!

Product Name: AtlasGIS Version: 3.0Manufacturer: Strategic Mapping, Inc.Address: 3135 Kifer Road, Santa Clara, CA 95051Telephone: 800-472-6277 or 408-970-9600FAX: 408-970-9999

Product Name: DataDirect ODBC Pack Version: 2.0Manufacturer: Intersolv, Inc.Address: 3200 Tower Oaks Blvd.Rockville, MD 20852Telephone: 800-547-4000 or 301-230-3200FAX: 301-231-7813

11 Btrieve Developer's Journal Vol III, No. 1 January-March 1995 (800) 828-7438 or (615) 386-3100 FAX: (615) 386-3135

² ²

Page 12: THE INDEPENDENT SOURCE OF NEWS AND INFORMATION …of BTI. fiThat™s why we built the Solution Network Š to give our customers access to the resellers, integrators, consultants and

BTRIEVE TECHNOLOGIES

MAD'S COLUMN

JANUARY-MARCH, 1995 SUPPLEMENT TO BTRIEVE DEVELOPER'S JOURNAL

TECHNICAL Q&A - INTERFACING TO BTRIEVE

TECHNICAL CORNER

Hello and welcome to the winter issueof Btrieve Technologies Tech-Corner.

Question: What do the BTI supportsurvey, the fall issue of BDJ, and the Btrievefor NT beta 6.15 have in common?

Answer: All have been accessed over200 times on the BTRIEVE CompuServeforum.

You may not have roamed the manysections of the BTRIEVE forum onCompuServe lately, but you may want to.One of the many ways that we are trying tostay in daily contact with our customers isvia CIS.

In addition to the typical messages andfiles that all companies respond to andupload on CompuServe, we are putting upsurveys, beta software, press releases, andpricing information daily, all in publicsections, to keep our customersknowledgeable on Btrieve Technologiesstrategy and on a myriad of topics.

The various sections are monitoreddaily by BTI staff members in services,engineering, sales, Q/A, and even RonHarris has his own account on CIS, allowinghim to respond to customer questions(when he is not trotting the globe) .

The only thing you may not see on CISany more is Doug Woodward usingNancy's CIS ID. He now has his very ownaccount.

We have had tremendous positiveresponse from founding BTI-Forumcustomers, of which there are already over8,000 members, on the quality of theinformation that is on our forum sections.

We hope to keep that information oneof the many strong links tying Btrievepersonnel to its customers.

Happy Programming!!

Mad PoarchVice President, Customer ServiceBtrieve Technologies, Inc.

Introduction

In order to create an applicationthat uses the MicroKernel DatabaseEngine (MKDE), a developer mustchoose the proper development tool.Btrieve Technologies, Inc. providesseveral developer kits for using theBtrieve Navigational ApplicationProgramming Interface (API) to accessthe MKDE. In addition, there are severaldevelopment tools available from othervendors. Many are mentioned here inthe Journal, as well as the SourceBookwhich ships with Btrieve products. ThisQ & A reviews the functionalityprovided by the developer kits availablefrom Btrieve Technologies.

What developer kits are available forBtrieve and how do I get them?

Btrieve developer kits are currentlyavailable for DOS (v6.15), Windows(v6.15), OS/2 (v6.15) and NetWare(v6.10). These can be purchaseddirectly from Btrieve Technologies, Inc.or through an Authorized BtrieveTechnologies Solution Integrator.

What programming languages aresupported?

Btrieve developer kits support mostcommon 3GL languages, includingC\C++, Pascal, BASIC\Visual Basic,and COBOL. Interfacing informationprovided in the developer kitsdocuments how to use the most popularcompilers for these languages.

How does an application call theMKDE?

The Btrieve Navigational API allowsan application to make function calls

with certain parameters which tell thedatabase engine what to do. A statuscode is returned to the callingapplication indicating whether or notthe requested action was successful. Astandard Btrieve API call lookssomething like this:

status = BTRV(Operation,PositionBlock,DataBuffer, DataBufferLength,KeyBuffer, KeyNumber)

The exact structure of the call variesdepending on the platform andlanguage being used. The Operationparameter defines the requested action(create a file, open a file, insert a record,etc.). Some or all of the otherparameters may need to be initializedwith a value, depending on whichoperation is to be performed. Inaddition, some of the parameters mayreceive data back as a result of theMKDE performing the operation.

The Btrieve Programmer�s Manualincluded in each developer kit describesin detail how to set the parameters foreach Operation, and what results toexpect after the operation is complete.

IN THIS ISSUE

Mad�s Column......................................17Technical Q&A: Interfacing to Btrieve....17Who�s Who at Btrieve Technologies.......18Btrieve 6.15 Server Edition.....................19BTI Solution Network............................20Technical Insights..................................21BTI Channel Partners.............................24Current Versions...................................24How to Reach BTI..................................24

(800) 828-7438 or (615) 386-3100 FAX: (615) 386-3135 Vol III, No. 1 January-March 1995 Btrieve Developer's Journal 12

Page 13: THE INDEPENDENT SOURCE OF NEWS AND INFORMATION …of BTI. fiThat™s why we built the Solution Network Š to give our customers access to the resellers, integrators, consultants and

How does a DOS application makeBtrieve calls?

The DOS Btrieve engine isimplemented as a TSR which is calledby most applications via an interrupt.The Btrieve for DOS Developer Kitincludes interface files that are eithersource code or object modules that arelinked to the application source code.

When a DOS application makes aBtrieve function call, the interface takescare of all the mechanics of making thecall to the MKDE.

How does a Windows application makeBtrieve calls?

The Windows Btrieve engine iscalled through a Dynamic Link Library(WBTRCALL.DLL). Any Windowsprogramming environment that can calla standard Windows 3.1 16-bit DLL canbe used to make Btrieve calls.

The Btrieve for Windows developerkit provides interface information, LIBfiles, and examples that can be usedwith C/C++, Borland Pascal andMicrosoft Visual Basic.

In addition, Btrieve Technologieshas released support for 32-bitapplications using the Win32s APIs.Check the BTRIEVE forum onCompuServe for more information.

How does an OS/2 application makeBtrieve calls?

The OS/2 Btrieve engine is alsocalled through a Dynamic Link Library(BTRCALLS.DLL). As in Windows, youshould refer to your OS/2 compilerdocumentation for instructions oncalling this DLL from a 16-bit or 32-bitapplication.

Information about the functionparameter declarations is included withthe Btrieve for OS/2 developer kit.

How does an NLM application makeBtrieve calls?

The NLM Btrieve Engine is calledthrough exported symbols. You cancreate an NLM application that calls theBTRIEVE.NLM using the NLM SoftwareDeveloper�s Kit available from Novell.

Your application simply imports theentry points defined by Btrieve andmakes normal function calls. The

Btrieve for NetWare Developer Kitprovides examples and documentationfor creating your own applications.

How can I develop a DOS ProtectedMode application that calls Btrieve?

Btrieve Technologies has recentlyreleased new C/C++ interfaces that canbe used with Borland�s PowerPack andPharLap�s DOS Extender v6.0. Thesecan be used to develop protected modeDOS applications that call Btrieve forDOS v6.15.

An interface for the Borland Pascalprotected mode compiler is alsoavailable.

A protected mode applicationwritten with these interfaces will not runin a Windows DOS box with Btrieve forDOS v6.15, since Windows DOS boxesdo not support running multiple DOSextenders.

What�s the difference to myapplication if I�m using a local versionor requester for Btrieve?

When compiling and linking yourapplication, you do not need to decidewhether your application will be runusing a Btrieve Workstation Engine, orin a Btrieve client/server environment.The application interface is the same ineither case.

Dede Harper works with keycustomer accounts and resellers andprovides worldwide education, trainingand sales support. Prior to joining BTIas a founding member, Dede was aSystems Engineer for Novell'sDevelopment Products Division for oversix years. Dede provided sales supportfor developers writing NetWare-specificapplications, including those developerswriting NLMs, database applications, orusing NetWare's client ApplicationProgramming Interfaces.

Dede is a graduate of the Universityof Texas at Austin. She received a B.A.in history with a minor in internationalstudies. In her spare time, Dede enjoyscooking, reading spy novels and murdermysteries, listening to music andplaying softball.

Dede Harper

Senior AccountManager

Chris Ojeda

Software SupportEngineer

Chris Ojeda joined BtrieveTechnologies as a founding member inApril 1994. Prior to his tenure at BTI,Chris worked as a Software SupportEngineer at Novell, Inc.

Chris' primary responsibilitiesinclude supporting developers and userswith the use of BTI's products. Chrisalso maintains the company'sCompuServe forum.

Chris is a graduate of SouthwestTexas State University, San Marcos,Texas. He received a B.A. in computerscience with a minor in businessadministration.

He and his wife Yvonne have a twoand one-half year old son, Zachary, andare expecting another baby inSeptember. Some of Chris' hobbiesinclude reading and playing the guitar.

Please make a note of BTI's newaddress. Telephone and faxnumbers remain the same.

Btrieve Technologies, Inc.8834 Capital of Texas Highway NorthSuite 300Austin, Texas 78759

NEW ADDRESS FOR BTI

WHO�S WHO AT BTRIEVE TECHNOLOGIES

13 Btrieve Developer's Journal Vol III, No. 1 January-March 1995 (800) 828-7438 or (615) 386-3100 FAX: (615) 386-3135

Page 14: THE INDEPENDENT SOURCE OF NEWS AND INFORMATION …of BTI. fiThat™s why we built the Solution Network Š to give our customers access to the resellers, integrators, consultants and

BTI Introduces Navigational Client/Server with Btrieve 6.15 Servers forNetWare and Windows NT

Btrieve 6.15�s navigational client/server environment allows programmersto chart the fastest path to their data bydesigning relational structures andfollowing them with precise directionalcontrols to retrieve, insert, delete andupdate distributed data. The keybenefits of the navigational client/serverapproach include the ability to controldistributed data routines in a client/server environment; to integrateexisting application code to easilyupgrade existing applications to client/server; to integrate with SQL throughBTI�s MicroKernel DatabaseArchitecture; and to avoid the massiveretraining costs associated with achange to new applications.

Btrieve 6.15 also features scalabilityfrom stand-alone to client/serversystems, improved transactionprocessing and increased overallperformance, as well as �set it andforget it� maintenance-free operation.

New Technical Features of Btrievev6.15 (Server Edition)

Btrieve v6.15 (Server Edition) is thefirst database server version built on BTI�sMicroKernel Database Architecture,introduced in August 1994. Equallyimportant, Btrieve v6.15 marks BTI�s firstcross-platform server product with theintroduction of Btrieve for Windows NT.As Btrieve for NetWare and Btrieve forWindows NT share a common codebase, these features apply to bothproducts. Since this is the first release ofBtrieve for Windows NT, however, someof the discussion about improvementsrefer to improvements for the currentNetWare version, Btrieve v6.10c.

Perhaps the most requestedenhancement for Btrieve is support for aDLL requester for Windows. Thiscomponent will be part of the Btrievev6.15 server edition releases. With thisDLL, you will no longer need to load theBtrieve for DOS requester to accessBtrieve data across the network from yourWindows application. All requestersupport is handled by the combination of

BTRIEVE 6.15 SERVER EDITION

WBTRCALL.DLL (the requester interface)and WBTICOMM.DLL (thecommunications interface). If youcurrently own one of our Scalable SQLproducts, you will already have a copy ofWBTICOMM.DLL. The Btrieve forWindows product also provides a copy ofWBTICOMM.DLL. You must install theBtrieve copy to enable the Btrieve forWindows requester to access client/server.

Btrieve 6.15 also includes requestersupport for the Windows NT workstation.This requester provides concurrent accessto Btrieve data on both NetWare andWindows NT servers.

A new version of the Btrieve for DOSrequester (BREQNT.EXE) that supportsconcurrent access to data on bothNetWare and Windows NT servers is alsopart of both packages. The familiarBREQUEST.EXE will continue to beavailable for accessing data on aNetWare server. However, if you wantaccess for both NetWare and WindowsNT servers, you will use BREQNT.EXE.When loaded, the default memoryresident size of BREQNT isapproximately 50K as a result of havingto include support for both NetWare andWindows NT.

Continuous operation support hasalso been improved. With Btrieve v6.15,we have rewritten the delta file supportfor continuous operations, removing ourdependency on the sparse files inNetWare. This redesign benefits us intwo ways: it eliminates the problemswith files becoming corrupted if theserver abends when Btrieve files are incontinuous mode; and as we move ourserver versions to other platforms that donot support sparse files, it gives us a moreportable version of the engine. In fact, itwill be possible to provide continuousoperations support on our workstationeditions as well.

The general performance of theMicroKernel Database Engine has beenimproved over the v6.10c versionthrough redesign of caching algorithmsand implementation of semaphores,rather than thread switching, to reduceCPU utilization. Earlier versions ofBtrieve did not return any records on aget or step extended operation if a recordin use status was returned. The

MicroKernel v6.15 returns data recordsup to the point that the record in use wasdetected.

Earlier versions of Btrieve alloweddevelopers to define AUTOINC keys,which could then be included as part of asegmented key. Although thedocumentation stated that this was notallowed, the engine did not enforce it andit worked as expected. Our users foundthis to be a useful feature and since it wasnot enforced, we designed for it. Thisfeature was removed in Btrieve v6 whenother problems in this area of the enginewere fixed. Several of our customers,who had taken advantage of the �feature�in the earlier versions, were disappointedto find that Btrieve v6.0 no longersupported it. So we made this featurework as it did in Btrieve v5.x. Indexsegments can now overlap an AUTOINCkey, if the AUTOINC key is a lower indexnumber than the segmented indexcontaining the AUTOINC type.

A new index type was added. Thistype, called NUMERICSA, is similar tothe NUMERIC, except that the embeddedsign is an ASCII value instead of anEBCDIC value. The numeric value forthis index type is 18. This data type wasadded to support the same data type inScalable SQL, again as a result of arequest from our customers.

With Btrieve v6.15, single recordlocks are not released after a failed GETwith lock operation.

The No Currency Change (NCC)option can now be used with insert andupdate operations in a data only file.

We also have had requests to allowthe Get/Step extended operations tosucceed even though the extendedoperation processing buffer is not largeenough to hold the entire record. Thebuffer must be large enough to containthe larger of the two - the filterexpression on input or all of the fields inthe record being extracted. This makes itmuch easier to use these extendedoperations with Btrieve files that havevery large records. This processing bufferis configured with the /b default size of16KB.

(800) 828-7438 or (615) 386-3100 FAX: (615) 386-3135 Vol III, No. 1 January-March 1995 Btrieve Developer's Journal 14

Page 15: THE INDEPENDENT SOURCE OF NEWS AND INFORMATION …of BTI. fiThat™s why we built the Solution Network Š to give our customers access to the resellers, integrators, consultants and

BTRIEVE TECHNOLOGIES SOLUTION NETWORK

product.The Database Technology Training

Center authorization program isdesigned for technical trainingorganizations who offer BTI�s databasetechnology courses.

The Professional DatabaseAdministrator certification program isdesigned for an individual who wishesto develop skills in the area of Btrieve 6and Scalable SQL databaseadministration and integration.

The Professional DatabaseApplication Developer certificationprogram is designed for an individualwho wishes to develop advanced skillsin the area of Btrieve 6 and ScalableSQL application development.

The Professional DatabaseTechnology Trainer certificationprogram is designed for the individualwho wishes to teach BTI�s databasetechnology courses.

Who Should Join the BtrieveTechnologies Solution Network?

The Solution Network programs arespecifically designed to provide BtrieveTechnologies current and future channelpartners with the products, support,sales tools, and training required tosuccessfully deliver informationmanagement solutions. BTI�s channel

What is the Btrieve TechnologiesSolution Network?

The Solution Network is acomprehensive set of channel programsdesigned for independent organizationsand individuals who, together withBtrieve Technologies, providecompanies with the integration services,consulting services, applicationsoftware, support and training servicesnecessary to deliver a completeinformation management solutions. TheSolution Network providesauthorization programs fororganizations as well as certificationprograms for individuals.

The Solution Integratorauthorization program is designed forvalue-added resellers (VARs) andintegrators who resell BtrieveTechnologies� database engines.

The Solution Consultantauthorization program is designed fordatabase design and developmentconsultants who recommend, but donot resell, Btrieve Technologies�database engines.

The Software Solution Partnerauthorization program is designed forindependent software vendors (ISVs)who resell Btrieve Technologies�database engines as an integratedcomponent of their own software

partners include: value-added resellersof applications built on Btrieve andScalable SQL; networking integrators orconsultants seeking to differentiate theirorganizations by offering client/serverdatabase integration; developers ofcommercially-sold Btrieve and ScalableSQL applications; and technical trainingorganizations. In addition, the SolutionNetwork offers certification programsfor database administrators, databasedevelopers and database trainers.

How Can an Organization orIndividual Join the Solution Network?

The first step is to contact BtrieveTechnologies at 800-BTRIEVE or 512/794-1719 and request a program kit.(Faxes may be sent to 512/794-1778.)BTI will respond with detailedinformation on the benefits andrequirements of each Solution Networkprogram; a program application; andinformation regarding regional trainingseminars.

The second step is to contact BTI atthe number above and register to attenda Solution Network AuthorizationProgram (SNAP) training seminar. This1 and 1/2 day educational seminar willbe held in major cities throughout theworld approximately every 9 months,starting in March 1995. The seminar isfree of charge, but space in some citiesis very limited.

BENEFITS OF THE SOLUTION NETWORK

PROGRAMS

DatabaseSoftware Technology

Solution Solution Solution TrainingIntegrator Consultant Partner Center

Authorization to resell Btrieve Technologies� server and workstation database engines Yes - Yes -

Authorization to sell BTI Product Support Contracts Yes Yes Yes -

Qualified leads and referrals for products and services Yes Yes Yes Yes

Priority product support Yes Yes Yes Yes

Database development, integration and management training Yes Yes Yes -

Discounted product pricing on purchases from BTI or BTI authorized distributor Yes - Yes -

Access to demonstration and training software Yes Yes Yes Yes

Access to pre-release software Yes Yes Yes -

Access to the Solution Network Forum on CompuServe Yes Yes Yes Yes

Subscription to Btrieve Technologies� Solution Network News Yes Yes Yes Yes

Joint executive briefings for key customers Yes Yes Yes -

Joint marketing and sales opportunities Yes Yes Yes Yes

Product literature and sales tools Yes Yes Yes -

Authorization to offer BTI�s database technology classes - - - Yes

15 Btrieve Developer's Journal Vol III, No. 1 January-March 1995 (800) 828-7438 or (615) 386-3100 FAX: (615) 386-3135

Page 16: THE INDEPENDENT SOURCE OF NEWS AND INFORMATION …of BTI. fiThat™s why we built the Solution Network Š to give our customers access to the resellers, integrators, consultants and

REQUIREMENTS TO PARTICIPATE IN THE

SOLUTION NETWORK PROGRAMS

Server Abend with Transactions onBtrieve version 5.x FilesBtrieve for NetWare 6.10c

With Btrieve for NetWare version 6.10c, ifyou are doing BEGIN/END TRANSACTIONS(Btrieve operations 19 & 20) then your Btrievefiles need to be in the new 6.x file format. Usingthe pre 6.x file format in transactions may resultin intermittent server abends when terminating atransaction. This problem is fixed in Btrieve forNetWare v6.15.

Continuous Operations and Page SizeBtrieve for NetWare 6.10c

With Btrieve for NetWare version 6.10c, ifyou are using Continuous Operations then yourBtrieve files need to have a page size of 512,1024, 2048, or 4096 bytes. Page sizes otherthan this may result in file corruption aftercontinuous operations complete. This problemis fixed in Btrieve for NetWare v6.15.

Continuous Operations & Sparse FilesBtrieve for NetWare 6.10c

NetWare 3.x and 4.x has a bug wheresparse files are corrupted after the server crashes.Btrieve for NetWare version 6.10c and6.15(shipped with Scalable SQL for NetWarev3.01) use sparse files for the delta files createdwith Continuous Operations.

If your file server crashes while you haveBtrieve files in Continuous Operations mode,you will need to delete the delta files when yourserver comes back up, BEFORE accessing theBtrieve files. You will not want to have thechanges rolled into your Btrieve files since the

delta files (sparse files) are corrupt. The newrelease of Btrieve v6.15 (subsequent to theScalable SQL for NetWare v3.01 release)includes a re-design of Continuous Operations sothat it no longer uses NetWare sparse files,thereby avoiding this corruption problem.

Supplemental Indexes and FileCorruptionBtrieve for NetWare 6.10c

With Btrieve for NetWare version 6.10c,the sort buffer used by Btrieve when addingsupplemental indexes may be allocated too largeon systems with a lot of server memory. Thisthen causes recursion that goes too deep whentrying to create the supplemental index on fileswith a large number of records (roughly over 1million) and small key lengths (1-10 bytes).Unfortunately, the result of this is a corruptedBtrieve file.

Since Brebuild�s Primary rebuild methodconstructs the keys AFTER adding the data to thefile, the newly built file may also be corrupt dueto this problem. You can limit the size of the sortbuffer by adding a -q parameter to the LOADBTRIEVE line in your BSTART.NCF. BtrieveTechnologies recommends adding -q=8000 (8meg) if you are affected by this problem. This isan upper limit; the engine will use smalleramounts when appropriate. This problem isfixed in Btrieve for NetWare v6.15.

Btrieve and File HandlesBtrieve Workstation Engines 6.15

In the Programmer�s Manuals for Btrieve(DOS/WIN) v6.15, it is noted that the maximum

TECHNICAL INSIGHTSnumber of Btrieve files an application can openmay be limited by system resources. Here isadditional information that explains this issue.(See page 4-118 in the DOS manual, and page5-118 in the Windows manual.)

Under Multi Engine File Sharing mode(MEFS), Btrieve will create and open a .LCK filefor each Btrieve file you open. Under SingleEngine File Sharing mode (SEFS), the .LCK filesare not opened, so you can open twice as manyfiles in this mode before running out of filehandles. Status 81 (Lock Error) will be returnedwhen trying to open a .LCK file, and status 87(Handle Table Full) will be returned if you aretrying to open a Btrieve file when handles runout. You�ll see status 87 usually under SEFS, andstatus 81 under MEFS. To open files in MEFSmode on a local drive, SHARE must be loaded,or you�ll get a status 81 on the first Btrieve openattempt.

OPENING LOCAL FILES

Factors in opening files on a local drive include:

w SHARE /F w CONFIG.SYS FILES= w BTRIEVE /F w Btrieve�s File Sharing Mode

The setting for the /L parameter on SHAREhas no effect on the number of files you canopen simultaneously. On the other hand, thesetting for the SHARE /F parameter is critical.The formula for calculating the /F parameter is:

((FILE�S ABSOLUTE PATH LENGTH + 11 BYTESFOR OVERHEAD) * #FILES TO OPEN)Multiply this result by 2 if you specify muti-engine file sharing (MEFS), to allow for the .LCKfiles.

For example, if your path isc:\users\xxxxxxxx.btr, and you set SHARE /F:3200, you could open 50 files under MEFS, or

DatabaseSoftware Technology

Solution Solution Solution TrainingIntegrator Consultant Partner Center

Approved application Yes Yes Yes Yes

Attendance at Solution Network Authorization Program (SNAP) training Yes Yes Optional No

BTI Professional Database Administrator Certification Within 18 Within 18 Optional Nomonths of months ofauthorzation authorization

BTI Professional Database Developer Certification Optional Within 18 Optional Nomonths ofauthorization

BTI Professional Database Technology Trainer Certification No No No Yes

Commitment to provide front-line installation and troubleshooting support Yes Yes Yes No

Annual volume commitment (AVC) No No No No

Annual membership fee (AMF) No No No No

(800) 828-7438 or (615) 386-3100 FAX: (615) 386-3135 Vol III, No. 1 January-March 1995 Btrieve Developer's Journal 16

Page 17: THE INDEPENDENT SOURCE OF NEWS AND INFORMATION …of BTI. fiThat™s why we built the Solution Network Š to give our customers access to the resellers, integrators, consultants and

100 files under SEFS (see section A of the chartbelow).

If you do not specify the /F when loadingSHARE, the default of 2048 will be used (seesection B of the chart). Notice that setting the /Funder the default (800 in the example) doesn�tseem to have an effect on the number of filesyou can open.

CONFIG.SYS can also limit the number offiles opened. The first 5 handles allocated byCONFIG.SYS (FILES=) are reserved for DOS. So,if you set FILES=250, then 245 files can beopened at once under SEFS, and only 122 filescan be opened under MEFS ((250 - 5) / 2).

Under SEFS, status 87 will be returned onthe 246th open. Under MEFS, status 81 will bereturned on the 123rd open. Notice that if wecould rely on the /F parameter of SHARE, withan /F:10000, we�d be able to open 312 files(10000 / 32) in SEFS mode, and 156 files ((10000/ 32) / 2) in MEFS mode; however CONFIG.SYSrestricts us to the number of files that can beopened.

In this chart, we assume that CONFIG.SYSFILES=250 and Btrieve /F:250. Note that themaximum SHARE /F parameter is 64K.

OPENING NETWORK FILES

Factors in opening files on a Novell networkdrive with the Btrieve client engines:

w NET.CFG FILE HANDLES= w BTRIEVE /F w Btrieve�s File Sharing ModeAgain, some handles allocated by NET.CFG(FILE HANDLES=) are reserved for the operatingsystem. Example: if you set FILE HANDLES=150, then 149 files can be opened at onceunder SEFS before you get a status 87 back, andhalf of that number of files (74) can be openedunder MEFS before status 81 is returned.

SUMMARY

If status 81 or status 87 comes back on aB_OPEN of a file on a local drive, increaseSHARE�s /F parameter, or CONFIG.SYS�s

FILES= parameter. If these status codes arereturned when the files are on a NetWare drive,increase NET.CFG�s FILE HANDLES parameter.Under MEFS mode, a maximum of 122 files canbe opened by Btrieve.

Status 11 and Status 12NetWare Btrieve 6.x

There are some key points of interactionbetween Btrieve and NetWare API�s in the sameprogram that could result in a Btrieve status 11(Invalid Filename) or a status 12 (file not found)returned on an open attempt.

If you are opening a Btrieve file without apath, in which case you expect it to be openedin the default directory, and you have called theNetWare API SetPreferredConnection() withanother server�s number (different from theserver where the Btrieve file is located), you willget a status 11 or 12. This call is only used withthe old C-interface for DOS (i.e. nit.lib). The fix isto get the default connection when the programstarts and make it the preferred connectionbefore the Btrieve open call. Under the newNetWare Client SDK, this is not a problembecause the application passes a connectionnumber on each call, and the API alwaysrestores the default connection.

When using the new Client SDK andmapping drives from an application, the API thatis used is SetDriveBase(). This call will always doa maproot. If the path sent in on SetDriveBase() isa volume with no subdirectories, a status 11 or12 can be returned on a subsequent Btrieveopen using the full path with this newly mappeddrive letter. In other words, a Map Root to thereal root of the volume will produce status 11 or12 on a subsequent Btrieve open where acomplete drive and path is specified.

EXTRA NOTE: OS/2 has always used theSetDriveBase() call, even in its utilities. So if youmap a drive in an OS/2 session you will alwaysget a Map-rooted drive. Since these are the driveletters shared by Global DOS boxes, you willrun into the above mentioned status 11 or status12 problem. The only work around at this pointis to map a drive that is a level deeper than thevolume level and use that drive letter in the pathspecifying the Btrieve file name.

Reasons for status 19 to be returnedBtrieve 6.x

Btrieve uses several stacks for maintainingtree position, depth, etc. If Btrieve detects that astack is corrupted, i.e., memory corruptionoccurred either due to a problem in Btrieve or byan external source, Btrieve will return a status 19.If Btrieve detects that it is about to �fall off� theend of a stack, or it can not find the beginning ofthe stack, it will return a status 19.

Btrieve is designed to handle many millionsof key values. During a get operation, Btrievewill recurse to the designated key value. If the b-

tree gets too deep, that is, more than whatBtrieve has allocated for a maximum value ofkeys, a status 19 is returned. This is a case wherea b-tree for a particular key is corrupted andBtrieve is probably in an infinite loop, recursingover and over. A status 19 would also bereturned if the Btrieve file used linked-duplicates,and the links were somehow corrupted.

During a Delete operation, Btrieve mustremove the key values, for each key, from eachkey page for the particular record. If the currentkey, e.g., key 0 is corrupt, it has been observedthat Btrieve returns status 2 or status 4. To deletethe other key values, Btrieve must find thosevalues and remove them from the other keypages. If one of the other key values can not befound, a case of a corrupted key page, a status 19is returned.

Btrieve�s File Control Record (FCR) containsa 30 byte key descriptor for each key in the file.If Btrieve determines that any of these descriptorsare corrupted, a status 19 is returned. Thesedescriptors are checked on each write to theBtrieve file.

In summary, a status 19 is usually returneddue to corruption of a Btrieve page, usually a keypage, but possibly the File Control Record.These states require that the Btrieve data file berebuilt.

Memory corruptions could be caused dueto hardware problems, or quite possibly, byBtrieve itself. Hardware problems such as badmemory chips, old LAN interface cards/driversor faulty network connections, can cause thememory corruptions. Try another server orswitch LAN interface cards to narrow down thecause. Check with the hardware vendor to besure the latest drivers are being used.

Btrieve and MS Access UpdateBtrieve for Windows 6.15

There is a Service Pack out for MicrosoftAccess, named ACCSVC.EXE (in MSACCESS onCompuServe, or on the Microsoft downloadBBS). It contains a new Btrieve driver and anupgrade to the Jet 2.5 engine.

Visual Basic Interface ErrorScalable SQL for Windows 3.01

The iDataType parameter is missing fromthe Visual BASIC Call Specification for theXQLDescribe function in the Scalable SQL forWindows Programmer�s Manual. On page 4-71of the August 1994 edition of this manual, add in�iDataType As Integer, � right after �ByValiPosition%,�. This same change should be madein the SQLAPI.BAS interface file on line 54where the Declare Function statement forXQLDescribe is defined.

Btrieve and CD ROM DrivesBtrieve 6.15

The status 12 (File Not Found) returned

A: Number of files and SHARE /F parameter /L:20 /F:6000 93 SHARE MEFS /L:100 /F:6000 93 SHARE MEFS

/F:5000 78 SHARE MEFS /F:4000 62 SHARE MEFS

B: Number of files and SHARE Defaults /L:20 /F:2048 31 SHARE MEFS /L:20 /F:800 31 SHARE MEFS

C: Number of files and CONFIG.SYS /F:10000 122 CONFIG.SYS MEFS

/F:10000 245 CONFIG.SYS SEFS

SHARE BTRIEVE LIMITED OPEN PARAMETERS FILES BY MODE

17 Btrieve Developer's Journal Vol III, No. 1 January-March 1995 (800) 828-7438 or (615) 386-3100 FAX: (615) 386-3135

Page 18: THE INDEPENDENT SOURCE OF NEWS AND INFORMATION …of BTI. fiThat™s why we built the Solution Network Š to give our customers access to the resellers, integrators, consultants and

LOAD SQLUTIL -SAVE vol:path\select.txtvol:path\output.sdf SDF /d:@dbnamewhere select.txt is the name of the file created instep 1. Refer to the Scalable SQL Installation andOperation Manual for more information on usingSQLUTIL.

3. Drop the Patients table, and recreate itwith the new field definitions. For example,

DROP TABLE Patients;CREATE TABLE Patients Using�Patients.dta� (ID char(6), First^Namechar(12), Middle^Initial char(2),Last^Name char(20), Address char(25),City char(15), State char(2), Zipchar(10), Phone char(12), Countrychar(20), Status char(10)) WITH INDEX(Last^Name MOD SEG, First^Name MOD, IDUNIQUE, ZIP MOD);

4) Import the data back into the new table.When using the SQLUTIL NLM, this can bedone using the BLOAD option. For example,

LOAD SQLUTIL -BLOAD Patientsvol:path\output.SDF SDF /D:@dbname

BLOAD is only available with the NLMversion of SQLUTIL, and performs a bulk load ofthe data. With the DOS or OS/2 version ofSQLUTIL, or from the SQLScope utility, the Loadoption can be used, which requires a text filecontaining an INSERT statement such as:

INSERT INTO Patients VALUES (@v1, @v2,@v3, @v4, @v5, @v6, @v7, @v8, @v9, @v10,@v11)where the number of substitution variablesmatches the number of fields in the table.

A customer was able to follow these steps,and using the SQLUTIL.NLM, rebuild a 180Megtable that had about 350,000 records with 4keys in about 5 hours (includes time for the Saveand the BLoad).

NOTE: the following procedure will notcorrectly rebuild the file:

When using ALTER TABLE, if the INDICTIONARY clause is used when adding allfields but the last one, so that the data file is onlyrebuilt on the last one, the resulting Btrieve file�srecord will only be large enough for the originalfields plus the last field added Therefore, theBtrieve file will not match the definition for thetable in the dictionary.

Scalable SQL Export to UNF FormatScalable SQL 3.x

When exporting constant values throughScalable SQL to a UNFormatted file, how willthe data be structured?

When using a Scalable SQL utility such asSQLUTIL or SQLScope to export data to UNFformat, a SELECT statement must be provided totell Scalable SQL what data to export. Thisstatement can contain constants in the field list,such as:

SELECT First^Name, Last^Name, City,State, �USA�, �Active� FROM Patients

when trying to open a file on a CD ROM drivehas been fixed with the 6.15.1 update of Btrievefor DOS and the 6.15.2 update of Btrieve forWindows.

However, Btrieve 6.15.x treats the CDROM as a remote drive. This means, ifSharingOnRemoteFiles=MultiEngine (thedefault) is specified in BTI.CFG/BTI.INI, Btrievewill return a status 81 (Lock Error) when trying toopen a file on the CD ROM drive. This isbecause Btrieve cannot create the .LCK file onthe (read-only) CD ROM that is required whenusing MultiEngine File Sharing. You have threeoptions to avoid this status 81:

w Change SharingOnRemoteFiles toSingleEngine (this may affect how otherBtrieve files are handled)

w Use the /i:<drive letter> option to redirectthe LCK file. This requires a duplicatedirectory structure under the specified driveletter as the directory structure where theBtrieve files are stored.

w From the application, add the -32 bias tothe key number used when opening the fileon the CD ROM drive. This will forceSingleEngine File Sharing on a per-file basis.This only works if EnableSharingBias=Yesin BTI.CFG/BTI.INI.

PMSWITCH and QEMMBtrieve for DOS 6.15

Problems may occur with protected-modeBtrieve (and PMSWITCH) running with QEMMv7.0+ and its DPMI driver, QDPMI.SYS.

QEMM�s installation program, whichinstalls QDPMI unless the user turns it off,configures it to automatically check for�incompatible extenders.� The documentationfor the new version (7.5) states that problems canoccur with some extenders, Rational Systemsamong them. One of the following fixes shouldbe used:

1. In a batch file that loads Btrieve/PMSwitch, issue the command QDPMINOXCHK before the load. This turns of thechecking for incompatible extenders. It may beturned back on with QDPMI XCHK.

2. Add VS:N to the main QEMMinstallation line in CONFIG.SYS. This turns offpage frame sharing by VCPI clients. It works, butit can slow the system down.

3. In code: There is a system call that canbe made before and after PM calls (documentedwith QEMM 7.5) that turns the checking forincompatible extenders off and on.

INOCULAN v1.0 Corrupting BtrieveFilesBtrieve, Any Version

Using Btrieve for DOS v5.10a in aNetWare environment, file corruption wasoccurring. The same application running withthe same Btrieve on a local drive did not cause

the corruption. The source of the corruption wasfound to be caused by version 1.0 of Cheyene�sINOCULAN.NLM, a virus checking NLM, thatwas treating the Btrieve file as an executible andmodifying it. Version 1.1 of INOCULAN.NLMdoes NOT cause this problem.

WXQLLOCL.DLL Not Found ErrorScalable SQL for NetWare 3.01

When trying to use the Scalable SQL forNetWare requester for Windows, the followingerror may be returned when trying to run anapplication: "SSQL-1: An error occurred whileWXQLLOCL.DLL was being loaded. The filewas not found."

The WXQLLOCL.DLL is used with thelocal Scalable SQL for Windows engine, not therequester. If this error is being returned, checkfor a BTI.INI file in the Windows directory andmake sure it has the following settings in the[Scalable SQL] section:

local=Norequester=Yes

If local=Yes, the WXQLLOCL.DLL andother Scalable SQL for Windows files areneeded, including WXQL32.DLL,WXQLRES.DLL and WDBNAMES.DLL. If theBTI.INI file is not located in the Windowsdirectory, a �local=Yes� setting is presumed.

Some applications may include the ScalableSQL for NetWare requester v3.01 components,and not the local engine. If the user does notcopy the BTI.INI file into the local Windowsdirectory, this error will be returned whenstarting the application.

Adding Fields to a Table Using ScalableSQLScalable SQL 3.01

The ALTER TABLE statement can be used toadd new fields to a table, but it can only add onefield at a time. Each time, it rebuilds the entirefile with the new record structure, which cantake quite a long time for large files.

Instead of using ALTER TABLE, you canachieve the modifications all in one rebuild byusing the SQLUTIL utility. For example, to addtwo new string fields called �Company� and�Status� to the Patients table in the demodatabase, follow these steps:

1. Create a text file containing a SELECTstatement that selects all the fields from the table,plus constants representing the new fields. Theconstants will be the values for the new fieldsinserted into every record in the new table.

SELECT *, �USA�, �Active� FROM Patients2. Use the SQLUTIL or SQLScope utility to

extract the data. SQLUTIL is available as a DOS,OS/2, and NLM utility; the NLM version willgenerally run the fastest. Using the NLMversion, the command line at the server wouldlook something like:

(800) 828-7438 or (615) 386-3100 FAX: (615) 386-3135 Vol III, No. 1 January-March 1995 Btrieve Developer's Journal 18

Page 19: THE INDEPENDENT SOURCE OF NEWS AND INFORMATION …of BTI. fiThat™s why we built the Solution Network Š to give our customers access to the resellers, integrators, consultants and

How will the constants be stored in theUNF file? The following chart details what willresult in the UNF file for various constant values:

Data Type UNF Type & Size

String constant of size N Zstring (N+1)

Integer Constant Integer (4)

Floating Point Constant Decimal(9) orFloat(8)

The following are examples of SQLconstants and their associated UNF output data:

Constant UNF output

�abc� abc<null> - 4 byte zstring

CURRENT VERSIONS

Btrieve Data Management Products

Btrieve Engine for DOS....................6.15.1Btrieve Developer Kit for DOS.........6.15.1

Btrieve Engine for Windows.............6.15.2Btrieve Developer Kit for Windows..6.15.2

Btrieve Engine for OS/2....................6.15.1Btrieve Developer Kit for OS/2.........6.15.1

Btrieve for NetWare NLM................6.15.2Requester for DOS (BREQUEST)...........6.16.1Requester for Windows (WBTRCALL)...6.15.4Requester for OS/2 (BTRCALLS)............6.15.1

Scalable SQL Relational DataManagement Products

Scalable SQL for Windows.................3.01Scalable SQL Developer Kit for

Windows...........................3.01Requester for Windows (WXQLCALL)......3.01Scalable SQL for NetWare

(Server Edition).....................3.01Requesters: DOS SQLREQ.EXE....3.01

SQLREQS.EXE...3.01Win WXQLCALL......3.01OS/2 XQLCALLS........3.01

XQL for DOS....................................2.11bXQL for OS/2......................................2.11

Query and Reporting Tools

Xtrieve for DOS................................4.11eXtrieve for OS/2................................4.11e

Btrieve Technologies, Inc.8834 Capital of Texas Highway NorthSuite 300Austin, Texas 78759Phone: (512) 794-1719

(800) BTRIEVE

Fax: (512) 794-1778CompuServe: GO BTRIEVEInterNet: [email protected]

[email protected]@btrvtech.com

You may also contact individual staff membersvia the Internet. The BTI Internet Domain Nameis btrvtech.com and user names consist of theperson�s first initial followed by up to sevencharacters of the last name. For example, MadPoarch�s address is [email protected]

HOW TO REACH BTI

�� (empty string) <null> - 1 byte zstring

5 05 00 00 00 - 4 byte integer

200.2 00 00 00 00 00 00 02 00 2F9 byte decimal

3.45E+4 00 00 00 00 80 D8 E0 408 byte float

If an import is going to be performed usingan exported UNF file, it is important to makesure that exported constants are the correct sizeand format expected by the fields in the tablereceiving the data.

BTI AUTHORIZED CHANNEL PARTNERS

MALAYSIA

Autocomp 6-03-2442002

NETHERLANDS

Artefact 31-15-617532

RUSSIA

ELCO 7-095-1315555Lanit 7-095-2673038Unitech 7-095-9395069

SLOVINIA

OPAL 386-64-632359

SOUTH AFRICA

SYS:COMM 27-11-8867812

SWEDEN

Linsoft 46-13-111588Scribona 46-8-7343400

THAILAND

Thaisoft 66-2-237-7622

UNITED KINGDOM

System Science 44-71-8331022

UNITED STATES/CANADA

GATES/Arrow 800-332-2222803-627-2100

GBC/Vitek 800-229-2296609-767-2500

Programmer's Shop 800-421-8006 617-740-2510

OTHER COUNTRIES

Contact Btrieve Technologies512-794-1719/Fax 512-794-1778

AUSTRALIA

Fagan 6-13-6999899

BELGIUM

IQN 32-16-502381

BRAZIL

Inbras 55-11-2884077

CROATIA

SYS 385-1-615223

CZECH & SLOVAK REPUBLICS

Abakus 42-2-24510942Oksystem 42-2-6843413SWS 42-67-981446

FRANCE

Interquad 33-1-41101500Micro Sigma 33-1-46229988

GERMANY

Compu-Shack 49-2631-9830Sienersoft 49-6126-5950SOS 49-8212-57820

HUNGARY

3Soft 36-1-212-2552Walton 36-1-2679010

ISRAEL

Mashov 972-3-7520190

ITALY

A&B 39-10-2770530

JAPAN

Novell Japan 81-3-54811161AG-Tech 81-52-9517054

19 Btrieve Developer's Journal Vol III, No. 1 January-March 1995 (800) 828-7438 or (615) 386-3100 FAX: (615) 386-3135

Page 20: THE INDEPENDENT SOURCE OF NEWS AND INFORMATION …of BTI. fiThat™s why we built the Solution Network Š to give our customers access to the resellers, integrators, consultants and

mean in a moment, but for now recall that the 80 hex inbyte 2 indicates that this refers to an index (in this case,an index for key 0). The next page pointer, beginning athex 1036 contains the 4 bytes �00 44 05 00'. Rememberfrom last issue that the hex 44 is a �D�, and that tells usthat the page being referred to is a Data page. One thingthat I got wrong last issue was the exact meaning of thepage pointer. Numbers used internally by Btrieve files are�byte swapped� as compared to �normal� Intel formatnumbers. For instance, to get the correct number for thepage pointer above, we need to swap the bytes in eachword of the above page pointer, which means hex �00 4405 00' becomes �44 00 00 05'.

Ignoring the 44, we are left with the number 5 (hex orotherwise...). Last time, I thought that the non-byteswapped value referred to a byte offset from just past theFCR and the PAT pages. The math actually worked outfor that one example. Silly me. As is often the case withdigging into undocumented or poorly documented detailsof a system, just because something works out for asample size of one, you cannot assume that you havefound the answer. Knowing about the byte swapping, it isobvious that the 5 is not a byte offset from anywhere. It isinstead a page pointer, meaning that the data page whichis logical page 2, is currently located in physical page 5.Since we know that the page size is 512, then we predictthat the data page in question (logical page 2 in the file)will begin at 2560 (5 * 512). Lo and behold, figure 2shows us exactly that!

When we modify a record in the file (one of only tworecords in the example file) we find that the PAT pointerto logical page 2 now contains �00 44 06 00'. Byteswapped, that tells us that logical page 2 is now onphysical page 6. Note also that when we look for the PATto find the physical page number, we are now looking atthe other copy of the PAT, which has had its usage countincremented. We can still look back at the other PAT pageto remind ourselves how the logical to physical mappingwas before the last change to the file.

As you should have noticed, pointers play a very largepart in figuring out exactly what is going on in a Btrievefile. Btrieve files currently contain two types of pointers.The first type, Page Pointers, we have already seen (inpainful detail, I might add). You should have noticed thatusing page pointers allows us to point a very largedistance. For instance, using a 512 byte page size, a pagepointer can point to 8 gigs of data. Forgetting for a secondthat NetWare, for example, cannot work with a single file

Further InsideBtrieve 6 filesBy Douglas J. Reilly, Access Microsystems Inc.

In my last column, I went into some detail of mysearch for the structure of Btrieve version 6 files, withspecial emphasis on the differences between Btrieve 5.xand Btrieve 6.x. While most of what I said about thestructure of the head of Btrieve version 6.x files wascorrect (for instance, 2 FCR pages, 2 PAT pages, etc.) insome areas my best guesses were wrong. Thanks to JimKyle (author of an new book on Btrieve to be publishedshortly by Addison-Wesley) and several folks at BTI forpointing me in the right direction for this issue�s column.

Btrieve 6 uses the concept of a logical page in additionto the more familiar physical page. For instance, inBtrieve versions before version 6, once a record is writtento a particular physical page in the file, the record willstay there for the life of the record. Changes were writtenover the existing records, with the old page being held ina pre-image file for reinstatement in case the write couldnot occur. Using this model, it was possible to know thephysical position of a record within the Btrieve file, andthat position would not change unless the record wasdeleted and then re-inserted.

Btrieve version 6 changes some of this. When arecord changes, the page where the original of the recordabout to be changed is stored is copied, with the changes,to a new physical page. The PAT that the page �reports�to is updated. The logical page remains the same, but thepointer found there now points to a different physicalpage. An example is in order.

Figure 1 shows the PAT page of a Btrieve version 6file. The page has a header of 8 bytes (2 bytes for the �PP�signature, 2 bytes for a PAT page number [starting with1], and 4 bytes for a usage count). The page pointer forlogical page 1 is first, starting at hex 1032. The hex valueis �00 80 04 00'. We will discuss what bytes 1, 3 and 4

Doug Reilly is the owner of Access Microsystems Inc., a softwaredevelopment house specializing in C/C++ software development, oftenusing Btrieve as a file manager. He has had articles on Btrieve published inDr. Dobb's Journal and is also the author of BTFILER and BTVIEWERBtrieve file utilities available on CompuServe. Doug�s CompuServe addressis 74040,607 and can be contacted at 404 Midstreams Road, Brick, NJ08724 or at (908) 892-2683.

(800) 828-7438 or (615) 386-3100 FAX: (615) 386-3135 Vol III, No. 1 January-March 1995 Btrieve Developer's Journal 20

Page 21: THE INDEPENDENT SOURCE OF NEWS AND INFORMATION …of BTI. fiThat™s why we built the Solution Network Š to give our customers access to the resellers, integrators, consultants and

Figure 1 - The Btrieve version 6 Page Allocation Table (PAT)

Figure 2 - The Data Page

larger than 4 gig, is there anything preventing Btrievefrom accessing files larger than 4 gig? In a word, yes.

The second type of pointer is a Record Pointer. Thisis a full 4 byte value (remember that the Page Pointer onlyhas 3 bytes, since one byte is used for a page typeindicator). Unfortunately, since a record pointer isrequired to point to a record at any arbitrary locationwithin a page, its range is far shorter (4 gigs, to be exact).Btrieve 6 handles these pointers in a very interesting way:To get the logical page number, simply take the value,and divide by the page size. The whole number result isthe logical page number, the remainder is the offset fromthe beginning of that logical page number. Anotherexample is in order.

Key pages are the pages that hold values that thecreator of a Btrieve file has decided to index and pointersto the actual data. Remember that where other pages havethe first two bytes on a page as signature bytes like �PP�or �CF� or �00 44' (a NULL followed by �D�), key pageshave as their signature bytes the key number plus 80 hexas their signature bytes. Look at figure 3. This is a keypage from the same file that previous figures were drawnfrom. Since the four bytes at the beginning of the page are�00 80 01 00', we know that this is a page for key 0. Ibelieve that the �01�, when byte swapped, will let us knowthat this is page 1 for this key. There are only two recordsin this file, and so that is a safe assumption. The next twobytes (�02 00') appear to be unused in version 6. The nexttwo bytes (in this case, �02 00') when byte swapped givethe count of the number of keys on the page. The next 4bytes (in this case, all �FF�) are a �Greater than� pagepointer. After this, the entries for each key begin. Thereis a pointer to a page number with key values less than thekey value this entry refers to, followed by the actual key(in this case, the key is a 10 character string,�TESTVER6\0\0� where �\0� is a NULL). After the keycomes the reason for this exercise, the pointer to the datarecord that this key is associated with, in our case, �00 0006 04'. Byte swap this value and we have 406 hex as therecord pointer. Take 406 hex, divide it by 200 hex (the

page size, decimal 512), and you get 2, with a remainderof 6. Looking back at figure 1, you will see that logicalpage two refers to physical page 5. Looking again atfigure 2, you can see that at offset 2560 (5 * 512) we havea data page. At offset 6, we have some characters that arenot part of the data we saved (hex �02 00', a �usagecount� that allows Btrieve to tell at the record level if achange has occurred, rather than at the page level) anddirectly after that, we have the actual record we expected.

The original goal of all this rooting around was to finda way to get at data in a Btrieve file, even if the data filewas damaged such that Btrieve itself was unable (orunwilling) to give the information to us. After all, myprimary interest in looking into the guts of Btrieve files isas a developer of Btrieve file recovery utilities. For thisarticle, I have developed a program called SALVAGE.C,a C language program that recovers records from aVersion 6 Btrieve file without making use of any Btrievecalls (see source listing, page 28). The program makes noattempt to handle variable length records, records withblank truncation or compression, or encrypted records. Asa side benefit, the program will also serve determine if a

file is not a Btrieve file, or if the file is not a Btrieveversion 6 file.

First the program includes the standard includes, inaddition to including SHARE.H. SHARE.H is includedbecause contains defines for file locking flags used by_fsopen(). It is important for this low level poking aroundthat we own the file. Notice above that we mention thatthe current PAT will change as updates to the file takeplace. If we did not insist upon exclusive access, even aswe are only reading the Btrieve file, changes could bemade to the file that will cause information we buffer togo �stale�. Another point in the listing that deservesattention is the use of a pragma to ensure that structuresare byte aligned. I used the Borland compiler to test this,and even though the Borland C/C++ compiler does bytealignment by default, I included the pragma call as areminder, and because the default behavior of Borland C/

21 Btrieve Developer's Journal Vol III, No. 1 January-March 1995 (800) 828-7438 or (615) 386-3100 FAX: (615) 386-3135

Page 22: THE INDEPENDENT SOURCE OF NEWS AND INFORMATION …of BTI. fiThat™s why we built the Solution Network Š to give our customers access to the resellers, integrators, consultants and

C++ can be overridden. We are trying to directly mapthis structure to data in the Btrieve file. The structure weare using must be exactly what we specify.

The FCRPAGE structure is a structure that exactlymaps the first 39 hex bytes of a version 6 File ControlRecord (page with an �FC� signature). Several fieldswhose use is unknown, or that are unimportant in thiscontext, are assigned names like �dontCare1�. Oneinteresting feature of this portion of the FCR record is theexistence here of the logical record length and the physicalrecord length. The numPages structure element isinteresting in that it appears to be only a count ofcurrently used pages, not including �FC� or �PP� pages(thanks again to Jim Kyle for the insight on this point). Iam not sure what possible benefit there is to this value,though it could be used to create a metric that wouldindicate how much slack exists in the file, that is, howmany previously allocated but currently unused pagesexist in the file. In the area of correcting incorrectinformation, in the Jan-March 94 issue of BDJ, I referredto the byte at offset 9 in a Btrieve file as �the number of256 byte segments in one Btrieve page.� While not strictlyspeaking incorrect, that is an incomplete explanation. ThepgSz element to the FCRPAGE structure actuallyrepresents the real page size: Since, for example, 512bytes i.e. 0x0200 hex, my interpretation was that the firstbyte of that value (0x02) was the number of 256 bytesegments in a page. It just so happens that I was onlyinterpreting the byte that held �the number of 256�s� inthe number (like having a decimal number 100 and seeingonly the first digit and saying it is the number of 100�s.True, but not a complete explanation. Live and learn.

The main() function first declares a number ofvariables, checks arguments, tries to open the inputBtrieve file and the output BUTIL format file, anddetermines the physical length of the file. Parenthetically,this value could be checked for divisibility by 512 anddivisibility by the pgSz element of the FCRPAGEstructure to ensure that the file length is compatible with

an allowable length of a Btrieve file.Next we read in the first 39 hex bytes of each of the

two �FC� pages, and determine which one is thecurrent �FC�. This is done by testing the usage countfor each of the 2 �FC� pages. We then do a byte swapto account for the non-Intel format byte ordering ofsome of the fields in the �FC� page. We then exit withan error message if the file is encrypted, or if the file isa variable length file, or if it is compressed. Thesetypes of files are an exercise for another day.

We next read in the first set of two �PP� pages,figure out which one is the current �PP� page, and dosome calculations, including trying to determine thenumber of sets of �PP� pages we can expect. TheppBuf is stuffed with a copy of the correct �PP� page.That done, we enter a do/while loop that reads throughthe image of the �PP� page, and if it is a data page (a�D� appears in the second byte of the page pointer) andif the other bytes of the page pointer are not all 0 (weactually do some byte tweaking to get the bytes in theorder we need to get the physical page number) weactually read the physical page into a buffer and callprocessDataPage().

In that function, we do the actual reading of datarecords, stepping through the page, testing for a non-zero usage count (the first two bytes of the physicaldata, NOT part of what the user has saved as therecord) that indicates that the record is current. Wesave the record into the sequential file in the BUTILFigure 3 - The Key Page

(800) 828-7438 or (615) 386-3100 FAX: (615) 386-3135 Vol III, No. 1 January-March 1995 Btrieve Developer's Journal 22

123456789012345678901234567890121234567890123456712345678901234567890123456789012123456789012345671234567890123456789012345678901212345678901234567123456789012345678901234567890121234567890123456712345678901234567890123456789012123456789012345671234567890123456789012345678901212345678901234567123456789012345678901234567890121234567890123456712345678901234567890123456789012123456789012345671234567890123456789012345678901212345678901234567123456789012345678901234567890121234567890123456712345678901234567890123456789012123456789012345671234567890123456789012345678901212345678901234567123456789012345678901234567890121234567890123456712345678901234567890123456789012123456789012345671234567890123456789012345678901212345678901234567123456789012345678901234567890121234567890123456712345678901234567890123456789012123456789012345671234567890123456789012345678901212345678901234567123456789012345678901234567890121234567890123456712345678901234567890123456789012123456789012345671234567890123456789012345678901212345678901234567123456789012345678901234567890121234567890123456712345678901234567890123456789012123456789012345671234567890123456789012345678901212345678901234567123456789012345678901234567890121234567890123456712345678901234567890123456789012123456789012345671234567890123456789012345678901212345678901234567123456789012345678901234567890121234567890123456712345678901234567890123456789012123456789012345671234567890123456789012345678901212345678901234567123456789012345678901234567890121234567890123456712345678901234567890123456789012123456789012345671234567890123456789012345678901212345678901234567123456789012345678901234567890121234567890123456712345678901234567890123456789012123456789012345671234567890123456789012345678901212345678901234567123456789012345678901234567890121234567890123456712345678901234567890123456789012123456789012345671234567890123456789012345678901212345678901234567123456789012345678901234567890121234567890123456712345678901234567890123456789012123456789012345671234567890123456789012345678901212345678901234567123456789012345678901234567890121234567890123456712345678901234567890123456789012123456789012345671234567890123456789012345678901212345678901234567123456789012345678901234567890121234567890123456712345678901234567890123456789012123456789012345671234567890123456789012345678901212345678901234567123456789012345678901234567890121234567890123456712345678901234567890123456789012123456789012345671234567890123456789012345678901212345678901234567123456789012345678901234567890121234567890123456712345678901234567890123456789012123456789012345671234567890123456789012345678901212345678901234567123456789012345678901234567890121234567890123456712345678901234567890123456789012123456789012345671234567890123456789012345678901212345678901234567123456789012345678901234567890121234567890123456712345678901234567890123456789012123456789012345671234567890123456789012345678901212345678901234567

Page 23: THE INDEPENDENT SOURCE OF NEWS AND INFORMATION …of BTI. fiThat™s why we built the Solution Network Š to give our customers access to the resellers, integrators, consultants and

format, which is the record length as an ASCII string,followed by a comma (a space would have been OKtoo), followed by the record image (the record imagebeing the logicalRecLen bytes starting two bytes pastthe start of the physical record), followed by the BUTILline terminator, hex D followed by hex A.

We continue at the top of the do/while loop until wehave read every set of �PP� records in the file(determined by the number of pages that can bemapped into a page worth of 4 byte page pointers). Inevery case, at the top of the do/while loop, we have thecurrent �PP� page in the ppBuf buffer.

There you have it. A very workable (thoughlimited) utility to salvage data from a version 6 Btrievefile, all without Btrieve even being loaded! Of course,there is much that separates this utility from acommercial grade file recovery utility (complex errorchecking, for one).

Going back to old business from last issue, I havestill not come across a way to predictably produce aPAT error. If you have a Btrieve file with a PAT errorwhere the data is such that you can send it to anoutsider, and it is of reasonable size, please feel free tosend it to me using my CIS address 74040,607 or mailto 404 Midstreams Road, Brick, NJ 08724. Inaddition, please feel free to send along any questions orsuggestions you have for covering the gory details ofusing Btrieve and Btrieve files in Inside Btrieve!

char *pageBuf; char *ppBuf; char *tptr; char tbuf[4]; long *tlong1; long *tlong2; long pageProcessed; long len; long totPages=0L; struct FCRPAGE fcrPage1; struct FCRPAGE fcrPage2; struct FCRPAGE *curFcr;

if ( argc<2 ) { usage();

exit(200); }

if ( (in=_fsopen(argv[1],"rb",SH_DENYRW))==NULL ) { printf("\nCan't open Btrieve file %s ",argv[1]); usage(); exit(201); } len=filelen(in);

if ( (out=_fsopen(argv[2],"w+b",SH_DENYRW))==NULL ) { printf("\nCan't open Sequential file %s ",argv[2]); usage(); exit(201); } fread((char *)&fcrPage1, (sizeof(struct FCRPAGE)), 1, in); if ( (strncmp(fcrPage1.signature,"FC",2)) ) { printf("\n%s appears not to be a Btrieve 6 file (SIG BAD)",argv[1]); usage(); exit(202); } pageSize=fcrPage1.pgSz; if ( pageSize>4096 || pageSize%512 || pageSize<512 ) { printf("\n%s appears not to be a Btrieve 6 file (PG SIZE)",argv[1]); usage(); exit(203); } /* seek to the second FC page */ fseek(in,(long)pageSize,SEEK_SET); fread((char *)&fcrPage2, (sizeof(struct FCRPAGE)), 1, in); if ( (strncmp(fcrPage2.signature,"FC",2)) ) { printf("\n%s appears not to be a Btrieve 6 file (SIG BAD)",argv[1]); usage(); exit(202); } pageSize=fcrPage2.pgSz; if ( pageSize>4096 || pageSize%512 ) { printf("\n%s appears not to be a Btrieve 6 file (PG SIZE)",argv[1]); usage(); exit(203); } if ( fcrPage1.usageCount>fcrPage2.usageCount )

curFcr=&fcrPage1; else

curFcr=&fcrPage2; curFcr->numRecs=swaplong(curFcr->numRecs); curFcr->numPages=swaplong(curFcr->numPages); if ( curFcr->ownerFlag>1 && !curFcr->owner[0]!='\0' ) { printf("\n%s appears to be encrypted.",argv[1]); usage(); exit(204); } if ( curFcr->variable!=0 ) { printf("\n%s appears to be Variable length.",argv[1]); usage(); exit(205); } if ( curFcr->logicalRecLen==0 ) { printf("\n%s appears to be Compressed.",argv[1]); usage(); exit(206); } pageBuf=calloc(pageSize,1); ppBuf=calloc(pageSize,1); if ( pageBuf==0 || ppBuf==0 ) { printf("\nMemory Allocation error",argv[1]); usage(); exit(207); } /* seek to the second FC page */ fseek(in,(long)pageSize*2L,SEEK_SET); fread(pageBuf, pageSize, 1, in); memcpy(ppBuf,pageBuf,pageSize); fread(pageBuf, pageSize, 1, in); tlong1=(long *)&ppBuf[4]; tlong2=(long *)&pageBuf[4];

/* if the usage count of the second page is greater than the first use it as ppBuf */ if ( (swaplong(*tlong2))>(swaplong(*tlong1)) )

memcpy(ppBuf,pageBuf,pageSize); pagesPerPat=(pageSize-8)/4; totPages=(len/(long)pageSize); numPats=(int)(totPages)/(long)pagesPerPat+1L;

#include "stdio.h"#include "stdlib.h"#include "string.h"#include "share.h"extern int errno;

/* this option ensures byte alignment in Borland C. Ensure that YOUR compiler is doing byte alignment when you do this. (or the magic won't work...) */#pragma option -a-

struct FCRPAGE { char signature[4]; long usageCount; int pgSz; /* multiply by 256 for actual page size */ unsigned char accFlag1; unsigned char accFlag2; long dontCare1; long dontCare2; int numKeys; /* ==-1 means key only */ unsigned logicalRecLen; /* user specified length */ unsigned physicalRecLen; /* includes length for dup pointers, usage count */ long numRecs; long unused1; int consistant; /* FFFF means file needs recovery */ int unused2; long numPages; long unused3; char owner[9]; unsigned char ownerFlag; unsigned char variable; /* lots more follows, we don't care for now */};

long filelen(FILE *t);long swaplong(long orig);void usage(void);void processDataPage(struct FCRPAGE *curFcr,FILE *out,char *pageBuf);

main(int argc,char *argv[]){ FILE *in; FILE *out; int pageSize; int loop; int done=0; int pagesPerPat; int numPats; int curPat=0;

Figure 4- SALVAGE.C Listing

Continued on page 42...

²

23 Btrieve Developer's Journal Vol III, No. 1 January-March 1995 (800) 828-7438 or (615) 386-3100 FAX: (615) 386-3135

Page 24: THE INDEPENDENT SOURCE OF NEWS AND INFORMATION …of BTI. fiThat™s why we built the Solution Network Š to give our customers access to the resellers, integrators, consultants and

²

Mr. Cohen is the owner of Cohen ComputerConsulting, an accounting software consultancy inRochester NY. He trains CPAs (certified publicaccountants) and CAs (chartered accountants -Canada) in trends in computer technology andaccounting software. His articles have appeared inAccounting Today, Audio Microcomputer Report,Buffalo Business First, CPA Software News, CPAJournal, Journal of Accountancy, RochesterBusiness Journal, Small Business Controller andother business and professional publications. Hewrote �Guide to Customizing Accounting Software�,and portions of numerous other books onimplementing computer technology. He can bereached via Internet at [email protected]

Btrieve BasedAccounting - Part 2Low-end, mid-range and vertical market Btrievesoftware ... and how to keep up with themarketplace

By Eric E. Coehn, CPA

You need to develop an accounting system for a new client?How would you like to save a hundred hours of yourprogramming time for $49?

You can find Btrieve-based accounting software to meet anybudget and to suit any business. The Btrieve-developer can thencustomize these packages to fit a business like a glove. In thiscolumn, we will discuss examples of accounting software on abudget, special offerings for businesses with special needs, andresources for researching, discussing, supporting and keeping upwith the accounting software marketplace.

In the last article in this series, we discussed the almostuniversal move to Btrieve by the accounting software vendors(ASVs). Spurred on by marketing pressure from consultants andend users and the results of LAN speed tests conducted by theinfluential PC Magazine, the ASVs of most low- and high-endaccounting packages have shipped or announced Btrieve-basedoptions for their accounting software.

At the same time, ASVs have felt the pressure to offercustomizable forms, reports and screens to their new Windowsofferings, and to ship their database dictionaries with the product,for external development. This is a major change. In the past,most accounting systems were considered “closed” anduntouchable, with the exception of a few xBase or Business Basicpackages, and any tampering or modifications were consideredinvitations for disaster. Now, the acceptance for tinkering withthe works by end users and consultants is high. This is anopportunity that Btrieve developers should pay close attention to.

Many end users and consultants feel that, becausemodification and customization tools are readily available, theycan do modifications and customizations themselves. (Stopsniggering out there!) What, you say? Certain steps in thedevelopment process, like planning, debugging and

documenting, are ignored by non-professional developers? Thiscan lead to problems later on.

While many of our reader may be amused by accountantsstuck in DO...WHILE loops, many accountants are similarlyamused by programmers who write accounting systems.

“First thing I did out of school? Wrote an accounting systemfor a manufacturing business.” People without an accountingbackground sometimes ignore certain accounting necessities, likedebits balancing with credits, audit trails for properaccountability, and actually collecting the information a businessneeds. If you think the difference between a 1099 and a 941 is a158, you should probably choose to develop around an existingsystem, rather than designing an accounting system from scratch.

LOW-END ACCOUNTING SOFTWARE

You can buy a commercially available Btrieve-basedaccounting system with documentation, marketing power, andASV lead generation for $49 and up; the only reason to developyour own accounting modules is to charge more for your ownsystem. While $49 accounting isn’t for everyone, the “low-end”accounting systems can meet a broad spectrum of needs.

Most “low-end” packages combine common accountingfunctions into a single package. These functions include GeneralLedger (for printing the financial statements), AccountsReceivable (for keeping track of what people owe you),Accounts Payable (what you owe others), invoicing (to let peopleknow they owe you money) and report writing (to write thereport they left out). Payroll is also included or available as aseparate option. While these combinations might retail at up to$1,000, they usually cost less than $150. These characteristics arenot absolute, of course. Solomon Software, an ASV of excellenthigh-end software, offers a vastly discounted price on the singleuser version of their software that might put it in this if pricealone is considered.

Low-end packages are aimed at small companies, most ofwhich do not have a dedicated accounting department. Low-endsoftware offers limited upgradability to more sophisticatedsystems and platforms. They do not have all of the capabilities ofthe high-end packages, despite the ASVs’ claims. Finally, finding

(800) 828-7438 or (615) 386-3100 FAX: (615) 386-3135 Vol III, No. 1 January-March 1995 Btrieve Developer's Journal 24

Page 25: THE INDEPENDENT SOURCE OF NEWS AND INFORMATION …of BTI. fiThat™s why we built the Solution Network Š to give our customers access to the resellers, integrators, consultants and

good support may be a problem.Small companies have very different requirements for their

systems than large companies. Small systems are run by theowner/manager or a close associate. Users need instant access toeverything, flexibility to do whatever they want, and the abilityto enter information as quickly as possible without time-consuming posting and printing routines. In a larger company,the owner/manager is further away from the basic data entrytasks, and wants a lot of protection built into the system to shieldthe user from making changes that are unaccounted for. In asystem used by many users, the owner/manager wants the dataprotected, passwords to limit prying eyes, separation of duties (sono one has complete control of accounting, limiting the ability tohide fraud and defalcations), audit trails that detail everytransaction, authorization processes, and posting routines, soControllers can review and change accounting entries from otherusers before it updates their General Ledger. Most low endpackages update data immediately, have limited passwordprotection, and come with few standard reports.

Most low-end packages are designed for DOS. Windows orthe Macintosh. Few low-end packages are designed for WindowsNT or Unix operating systems, or for cross-platform use.

For children of advertising, repeat after me: “Low-endpackages do not do everything high-end packages do. The adsare fluff.” They may not even do all the tasks you would expect alow-end system to do. Users happy with the DOS version of aproduct may switch to the new Windows version, only to find outthe Windows version may be radically different than the DOS

version in capabilities. Do you want to enter orders from yourcustomers, print picking lists to tell shipping to pull togetherwhat is available, and then tell the system what shipped? Sorry,that feature was removed from the Windows version. Ooops.

Open order processing is not available in many low-endpackages. Nor are features for specialized commissioncalculations, heavy shipping needs, or integration with LotusNotes and third party business systems. Few low end packagesdevelop relationships with other companies to provide theselinks. Few packages move out of the needs of a distributionoriented company to meet the needs of manufacturing,construction or retail business.

Finding good support for low-end products may be aproblem. You are more likely to find consultants supporting thehigh end than the low end packages. That’s largely becauseconsultants have more incentive to master high end accountingsoftware than low end packages. It is difficult to justify $125/hour for twenty hours of training on a $125 package. It is alsoharder to make money selling retail channel software than VARchannel software - there are no margins for a product that sells atCompUSA or Computer City. If a business requires expert helpin making the accounting package work within the company,consultants are invaluable for helping get the package going withhands-on, ongoing implementation help. Low end support comesmostly from toll-free or long-distance phones numbers, fax lines,or on-line support, like CompuServe. This is a problem, as lowend products have a reputation for bugs. Recent discussions onCompuServe show that some of the most popular packages havemajor problems - one popular vendor was showcased in the WallSt. Journal because of their bug problems (excuse me, programanomalies, or was that undocumented features?) Don’t let thatfool you - high end products have bugs too - but the consultantshelp take care of that.

Examples of Low-end Btrieve products

When you say low-end accounting, two names immediatelycome to mind of anyone in the business for more than a fewyears: DacEasy and Peachtree. Others have joined the group,including the next generation of the Microsoft/Great PlainsSoftware joint venture, Profit, that has been taken over andupdated by Great Plains.Low-end accounting is not the joke it once was in accountingcircles. Most are networkable from the box, offer sophisticatedfile import and export, strong and flexible printing, and trackinventory costs in many ways. They come with multiple generalledger charts of accounts, and guides to help you in theaccounting process.

Pacioli 2000 MondialM-USA Business Systems Inc., 15806 Midway Road, Dallas TX 75244-2195800-777-4287

Pacioli 2000 is our $49 software entry. Pacioli comes withGeneral Ledger with budgets and auditing, Accounts Receivable,Accounts Payable, Inventory Control, Billing, Purchase Ordersand Report Writer. It comes on a single disk and required lessthan 2MB of disk space to get started.

It provides multi-company support with the ability tocombine the financial results of the companies (consolidation),customizable financial statements, 3 years of General Ledger

123456789012345678901234567890121234567890123456712345678901234567890123456789012123456789012345671234567890123456789012345678901212345678901234567123456789012345678901234567890121234567890123456712345678901234567890123456789012123456789012345671234567890123456789012345678901212345678901234567123456789012345678901234567890121234567890123456712345678901234567890123456789012123456789012345671234567890123456789012345678901212345678901234567123456789012345678901234567890121234567890123456712345678901234567890123456789012123456789012345671234567890123456789012345678901212345678901234567123456789012345678901234567890121234567890123456712345678901234567890123456789012123456789012345671234567890123456789012345678901212345678901234567123456789012345678901234567890121234567890123456712345678901234567890123456789012123456789012345671234567890123456789012345678901212345678901234567123456789012345678901234567890121234567890123456712345678901234567890123456789012123456789012345671234567890123456789012345678901212345678901234567123456789012345678901234567890121234567890123456712345678901234567890123456789012123456789012345671234567890123456789012345678901212345678901234567123456789012345678901234567890121234567890123456712345678901234567890123456789012123456789012345671234567890123456789012345678901212345678901234567123456789012345678901234567890121234567890123456712345678901234567890123456789012123456789012345671234567890123456789012345678901212345678901234567123456789012345678901234567890121234567890123456712345678901234567890123456789012123456789012345671234567890123456789012345678901212345678901234567123456789012345678901234567890121234567890123456712345678901234567890123456789012123456789012345671234567890123456789012345678901212345678901234567123456789012345678901234567890121234567890123456712345678901234567890123456789012123456789012345671234567890123456789012345678901212345678901234567123456789012345678901234567890121234567890123456712345678901234567890123456789012123456789012345671234567890123456789012345678901212345678901234567123456789012345678901234567890121234567890123456712345678901234567890123456789012123456789012345671234567890123456789012345678901212345678901234567123456789012345678901234567890121234567890123456712345678901234567890123456789012123456789012345671234567890123456789012345678901212345678901234567123456789012345678901234567890121234567890123456712345678901234567890123456789012123456789012345671234567890123456789012345678901212345678901234567123456789012345678901234567890121234567890123456712345678901234567890123456789012123456789012345671234567890123456789012345678901212345678901234567123456789012345678901234567890121234567890123456712345678901234567890123456789012123456789012345671234567890123456789012345678901212345678901234567123456789012345678901234567890121234567890123456712345678901234567890123456789012123456789012345671234567890123456789012345678901212345678901234567123456789012345678901234567890121234567890123456712345678901234567890123456789012123456789012345671234567890123456789012345678901212345678901234567123456789012345678901234567890121234567890123456712345678901234567890123456789012123456789012345671234567890123456789012345678901212345678901234567123456789012345678901234567890121234567890123456712345678901234567890123456789012123456789012345671234567890123456789012345678901212345678901234567

Page 26: THE INDEPENDENT SOURCE OF NEWS AND INFORMATION …of BTI. fiThat™s why we built the Solution Network Š to give our customers access to the resellers, integrators, consultants and

period result retention, purchasing with return processing, andthe capability to predefine what printer certain forms should goto, features which many high-end packages do not provide. Itsweaknesses include a strange chart of accounts structure thatincludes the customers and vendors, inventory valuation limitedto standard and last cost, ad limited standard reporting. Unusualfor a low-end, it is a batch (posting process) based system.! Butfor $49 ...

Mondial is Pacioli’s big brother, at $199.95. It comes on twodiskettes; look to set aside 8 MB of disk space. To Pacioli’scapabilities, add Order Entry, Point Of Sale, Multi-locationwarehousing, manufacturing assembly control, job costing,multi-currency capability for international transactions andinvestment tracking. The Chart of Accounts id far more flexible,and it handles open orders, drop shipments, quotations andlayaways. Inventory tracking includes most basic valuationmethods A separate payroll module is available. Thedocumentation and on-line help were weak, and you may find itsperformance on a network limiting by its locking routines.

Profit 2.0Great Plains Software, 1701 Southwest 38th Street, Fargo, ND 58103800-456-0025 or 701-281-0550

Great Plains Software has shipped an update of Profit. Profitversion 1 was co-developed by Great Plains and Microsoft andsold by Microsoft since February 1993. Great Plains reacquiredthe package from Microsoft one year later and, in version 2.0,has added a great deal of flexibility, including fully customizable

forms. Developed in Visual Basic 3.0, Profit uses help wizards tohelp with development tasks. The retail price is $249 (withpayroll, $299) and upgrades from prior versions are $79. GreatPlains has indicated that they will make the DDFs available forversion 2.0, and that a developer’s kit will be available.

Profit ships on 4 disks, and set aside 15 MB of disk space. Italso creates some subdirectories that we have not yet been able toremove from our test equipment. It provides General Ledger,Accounts Receivable, Accounts Payable and purchasing, limitedPayroll (a separate full Payroll module is available), Inventory,Project Management and a built in Executive Information System(EIS) called Profit Signs. The documentation and on-line help isvery good and the software itself is elegant, but sometimes theflexibility gets confusing - an after entering an invoice, you aregiven many choices of what to do: print now, printing a batch,defer it for later, schedule for recurring at a future date -featuresthat probably just take getting used to.

Peachtree Accounting for Windows 3.0Peachtree Software, Inc., 1505-C Pavilion Place, Norcross GA 30093800-228-0068 or 404-564-5700, fax 404-564-5888

For $169, you get 5 disks of software that fills up 15 MB (11MB without the tutorial). Or, the same money buys a CD-ROMthat has on-line documentation, a business logo library, WindowsCompuServe Information Manager, a Business library, faxsoftware, label software, and tutorial software. And, oh yes, youget Peachtree for Windows.

Peachtree gives you General Ledger, Accounts Receivable

123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123

Page 27: THE INDEPENDENT SOURCE OF NEWS AND INFORMATION …of BTI. fiThat™s why we built the Solution Network Š to give our customers access to the resellers, integrators, consultants and

with quotes & billing, Accounts Payable with purchasing,Inventory Control with Assemblies, Job/Project tracking, andPayroll. Peachtree offers flexibility unrivaled in the class. Youcan choose between batch and real-time processing and cash oraccrual accounting. You can keep 2 years open in the GeneralLedger and maintain custom fields for information in the masterfiles. Field sizes were generous, such as a 15 digit alphanumericchart of accounts that lets you use sophisticated maskingtechniques for financial reporting..

Using the system is also easy. Set up was a breeze, you canfind the task you need to do from both menus and from roadmaps, graphical representations of the accounting process.SmartGuides (like Wizards) lead the user through the data entryprocess. The Peachtree built-in EIS includes alerts, to-dos andevents - it can warn you if cash goes to low, a salesman hitsquota, or if it is time to reorder something, automatically.

Forms and reports are all customizable, and the cashmanager with its spreadsheet view, collection manager, andpayments manager make Peachtree 3.0 a veritable office in abox.

It isn’t perfect. It is limited to a single warehouse, there is noopen order capability and budgeting on the financials is limited.

Need more power? The DOS version is missing a lot of theautomation, but for $399.00, you get order entry and fixed assetmanagement. Cash management can be added for $79.00, as cana contact management system.

DacEasy version 5.0DacEasy, Inc. 17950 Preston Road, Suite 800, Dallas TX 75252800-DAC-EASY or 214-732-7500

DacEasy version 5.0 for DOS offers more sophistication andgrowth capabilities than the other packages described here.However, DacEasy has not chosen Btrieve for its Windowsoffering.

DacEasy version 5 costs $149.95 single user, and $299.95for multi-user. As a non-Windows offering, it required around3MB of hard disk space to get started. It includes GeneralLedger, Accounts Receivable, Accounts Payable, Billing, CashManagement, Purchase Orders, Inventory Management, andFixed Assets. It offers reporting and customization capabilities ona par with the Windows packages. Its reporting capabilities withthe DacEasy Publisher provide database access to information ona par with a high end database management system. Available inbatch processing, accrual basis only, nice features include 150kfreeform notes, kitting in inventory, 1099 printing, FASB 95 cashflows reporting required by larger businesses, and the ability tokeep 26 periods open.

Also unique in this class is the breadth of vertical add-onsavailable. A separate Job Manager for DOS version 5 is a truejob cost system, with estimating, bids, and cost tracking - it canimport CAD data for creating estimates. A separate Point of SaleSystem version 5 (stand-alone or integrated with DacEasy)integrates with scanners, cash drawers, display devices andreceipt printers, and tracks serial numbers, layaways, tracksmultiple tender types and quotes. A separate Order Entrymodules version 5 (stand-alone or integrated) tracks and printsquotes, orders, blanket orders, and returns. It supports remoteorder collection and entry for salespeople. A separate Payrollmodule is available, as is the DacEasy EIS Windows reporter,which works not only with DacEasy data, but also with ODBC/

Btrieve.There is a large assortment on non-Btrieve competition in

this area. Many businesses user the personal finance package,Quicken from Intuit, for their business, and some its morebusiness oriented brother, QuickBooks. These packages aresomewhat legendary for their ease of use, and features fromQuicken are finding their way up into the higher end asenhancements. One Write Plus (NEBS) is popular among CPAsas an easy migration from the popular paper-based systems fornon-sophisticated computer users (and CPAs). M.Y.O.B. - that’sshort for “Mind Your Own Business” - (Best!Ware) and SimplyAccounting (Computer Associates) are Windows/Macintoshpackages that can meet the needs of many smaller businesses.

Mid-Range Accounting Software

The middle end offerings defy definition a bit more. Oneclass is the more expensive, single module integrated systems,combining many more functions than the low end (order entry,job cost, point of sale, manufacturing assemblies) with the backoffice functions at a price exceeding $1,000. The other class aremodular packages, where you buy each function (GeneralLedger, Payroll or Job Cost, for example) separately, at a cost of$200-$500 per module.

A search for Btrieve based mid-range products turned upempty. The market is best represented by three products, none ofwhich is Btrieve based. BusinessWorks from ManzanitaSoftware, which recently merged with State of the Art, Inc., isbased on a proprietary database. SBT from SBT Corporation andAccountMate from SourceMate are xBase-based.

SBT and AccountMate may still be excellent choices for theBtrieve developer. SBT has multiple version of its software atdifferent price points and levels of sophistication. SBT andAccountMate make their xBase code available to the developer,along with some of the best documentation in the business formodifying their software. xBase products like dBase, Clipper andFoxPro can be integrated with Btrieve fairly easily using Btrievelibraries like RaSQL, or dbftrieve.

Few mid-range products are Btrieve-based, but may stilloffer a foundation for development. In the next BtrieveDevelopers Journal, we will discuss high-end accounting andadd-on systems. In the meantime, there are a number of softwarepackages designed to meet the special needs of vertical markets.Following is a brief list of some of these vertical markets andpackages of special note to Btrieve Developers.

Time and Billing

Time & Billing systems meet the billing and reporting needsof companies whose stock in trade is time. Accountants,attorneys and programming shops sell their time, and need tocharge back expenses associated with various tasks as well. Oneof the best known packages, TimeSlips, recently advertised onthe on-line services for developers capable of integratingTimeSlips with accounting software.

See Accounting on page 36...

27 Btrieve Developer's Journal Vol III, No. 1 January-March 1995 (800) 828-7438 or (615) 386-3100 FAX: (615) 386-3135

Page 28: THE INDEPENDENT SOURCE OF NEWS AND INFORMATION …of BTI. fiThat™s why we built the Solution Network Š to give our customers access to the resellers, integrators, consultants and

By Bill Mitchell, Liant Software Corporation

The Relativity product enables the definition of relationaldatabases on COBOL data. This COBOL data can reside in anyof a set of file formats, including Btrieve files. The Relativityrelational database on the COBOL data makes the data availablethrough Windows ODBC-enabled front-end tools. Examples ofsuch tools are Microsoft Access, Excel, and Word, CrystalReport Writer, and Cognos Impromptu.

A key feature of this product is that it derives much of thedatabase information from the COBOL source. This allows therelational access to the data to encompass much of theinformation already present in the COBOL source. Much of thisCOBOL specific information is not available or not used throughalternative methods to reach the data.

A second key feature of this product is that the existing datais accessible where it resides, without conversion or replicationinto a new format. Existing COBOL programs accessing theBtrieve data continue to run unchanged.

A third key feature of this product is that the DatabaseDesign tool uses the Windows multiple selection and drag-on-drop paradigms. This allows the new user quickly to use thedesign tool to define relational tables without learning a complexlanguage syntax.Relational Design

As with any application system, especially any systeminvolving relational access to data, the initial design phase is veryimportant. Many COBOL applications were designed before thebenefits of normalization of data were understood. TheRelativity Database Designer allows multiple definitions of SQLtables on the same COBOL record layouts. These SQL tablescan be defined to achieve whatever degree of data normalizationis desired.

Of course, to develop some understanding of the product andits capabilities, one can prototype a database without a detaileddesign of all the intended functionality. As the existing COBOLprograms are continuing to function as they are, this prototypingis especially easy. The initial database can be defined to providenew retrieval capabilities not present in the current COBOLapplications. Further functionality can be added incrementally.After this experience is gained with simple relational views,Relativity can be used to design and implement a more structureddatabase, or the incremental addition of functionality can becontinued indefinitely.

When you have an idea of the relational view you want ofthe COBOL data, you are ready to use the Relativity Database

Designer to describe this relational view. It is helpful to think ofthe database definition has having two parts, the file side and therelational side. First you import the COBOL file information intothe database definition and massage it to make it easier to use,then you define the relational views on the COBOL file data.Database Creation

Walking through the creation and definition of a COBOLdatabase may give you a taste of the capabilities of the Relativityproduct.

A new COBOL data source can be created either through theRelativity Database Designer or through the ODBC ControlPanel. From the Relativity Database Designer, the File, NewDatabase menu selection brings up the same ODBC RelativitySetup as the ODBC Control Panel. At this point, one specifiesthe ODBC datasource name that will be used for future access tothe database. In this example, the datasource name “BtrieveExample” was specified.

For a new database, a new catalog file must also be created.The Create Catalog dialog allows the pathname of the catalog tobe specified similar to typical File Open dialogs. This pathnameshould reside in the same directory or a parent directory of theCOBOL data files that will be included in the database. In thisexample, the path “d:\btrieve\samples.rct” was specified.

After the new database is created, the Relativity DatabaseDesigner brings up the datasource selection dialog. The newlycreated datasource, “Btrieve Example,” can now be selected.This is followed by the ODBC logon dialog. Enter the id youintend to use as the owner here, although the id will not be useduntil database privileges are enabled. This owner id is theRelativity database owner id, and is distinct from the Btrieve file

Relativity

(800) 828-7438 or (615) 386-3100 FAX: (615) 386-3135 Vol III, No. 1 January-March 1995 Btrieve Developer's Journal 28

Page 29: THE INDEPENDENT SOURCE OF NEWS AND INFORMATION …of BTI. fiThat™s why we built the Solution Network Š to give our customers access to the resellers, integrators, consultants and

owner id, although the same string can be used for both, ofcourse.

Importing File Definitions

At this point you are ready to import COBOL file definitioninformation into the catalog. In this example, an RM/COBOL-85source program is assumed, as the mechanics of the process aredifferent for different compilers. Compile the COBOL sourcewith the RM/COBOL-85 for Windows compiler. This will createa .cob object file with the symbolic debug information from the.cbl source file.

Back in the Relativity Database Designer, the File, ImportCOBOL FDs dialog allows the COBOL object file to be selected.In the example, the object file orders01.cob is selected. In thisobject file there is only one program. Adding this program to thelist of programs from which to import and entering the SelectFiles dialog shows that this program contains File Definitions forfive files: CUSTOMER-1-FILE, DESCRIPTION-FILE, ORDER-FILE, PRODUCT-1-FILE, and SALES-FILE. The Add Allbutton is a convenient way to import all these files into the newdatabase.

Once these files have been imported into the databasecatalog, the Files: list box at the top of the screen can be used toselect an individual file. For each individual file, additionalCOBOL data information can be entered and the relational tablescan then be defined.

Adding Information to the COBOL Definition

Although the COBOL file definition provides muchinformation about the layout of the data in the file’s records,

some data information is handled in COBOL in thePROCEDURE DIVISION and must be added to the fileinformation before defining relational tables.Global Changes to Column Names

The rightmost three buttons on the toolbar control the editingof default column names for the COBOL data items.It is common in COBOL programs, especially older COBOLprograms, for all the data item names to be represented in upper-case. This is not an attractive style for SQL column names, andpressing the first of these buttons, “a”, changes these names tomixed case.

Separating elements in a COBOL data item name wastraditionally accomplished through hyphen characters. Thesecharacters are not allowed in SQL. The second of the columnname buttons allows one to choose between replacing thesehyphens with underscore characters or removing the separatorcharacters from the column names entirely.

One common COBOL coding style is to prefix every dataitem in a file with the same characters. These characters areprobably less than useful in any SQL tables defined on theCOBOL data. The rightmost button in the tool bar allows one toedit the default column names for every COBOL field. Whenthis button is pressed on the example data, the RelativityDatabase Designer recognizes that the characters “PF” arecommon to most of the fields. The Edit Default Column Namesdialog allows these leading characters to be removed from thedefault column names for each field.

Determining Record Types

In this example, the PRODUCT-1-FILE contains threerecord layouts. These record layouts represent availableproducts, back-ordered products, and discontinued products.They are described through multiple 01 groups defined on thesame record area. The data before the group PF-AVAILABLE-DATA is common to all record layouts; following data is specificto particular record layouts.

Relativity provides several ways to handle variant data suchas this. The more relational manner is to treat the several recordstypes as record variants and to define a separate relational tableon each variant. An alternative approach is to define a singlerelational table on the COBOL record, but to define certaincolumns as NULL when the corresponding field is not present ina record.

In this particular example, we will represent the three recordlayouts as three record variants. The mouse is used to select allthe items in the first 01 record layout, then to select the <new

29 Btrieve Developer's Journal Vol III, No. 1 January-March 1995 (800) 828-7438 or (615) 386-3100 FAX: (615) 386-3135

Page 30: THE INDEPENDENT SOURCE OF NEWS AND INFORMATION …of BTI. fiThat™s why we built the Solution Network Š to give our customers access to the resellers, integrators, consultants and

record type> variant to associate a name with this set of COBOLdata items. The Edit Record Type pull-down can then be used todefine the conditions under which a file record is recognized asthis record variant. In this database, the 88 condition itemPRODUCT-AVAILABLE is true when the record represents anavailable product. If the COBOL application contains no 88items and acts upon the records through simple IF statements,e.g., IF PF-STATUS-CODE = ‘A’, the Database Designer can beused to add 88 items to the file definition.

Following similar steps, one can define additional recordvariants for backordered product records and discontinuedproduct records, associated with the 88 condition itemsPRODUCT-BACK-ORDERED and PRODUCT-DISCONTINUED, and containing the common fields and thebackordered or discontinued fields, respectively.Defining Data Types

The COBOL language was developed before user defineddata types were included in languages. Yet it is common whendata is represented in multiple files for all the data declarations tobe identical. The Relativity Database Designer has twocomplementary techniques for representing data types — onedefines common SQL column types, and one recognizes commonpatterns in COBOL data.

In this example, we use the File, Item Patterns dialog to adda pattern for recognizing date fields. Looking at the PRODUCT-1-FILE record definition, one sees a date field, PF-DATE-STOCK-EXPECTED. Assuming this date field is representativeof similar fields in other files, we define a COBOL Item Patternfor unsigned DISPLAY numeric data of length 8 with nofractional digits, with the characters DATE anywhere in thename.

We associate with this item pattern a YYYYMMDD transformto convert the 8 COBOL digits into an SQL date. We wouldchoose a different transform, e.g., MMDDYYYY, if dates wererepresented month-first in this COBOL application.

A button on the toolbar is used to compare all the data itemsin the COBOL record with the defined patterns. In thisexample, the PF-DATE-STOCK-EXPECTED item isrepresented now as a date, and the YYYYMMDD transform isassociated with the item. This will cause every column definedon this item to be translated to a date the same way. This use ofan item pattern allows the same transformation to be applied tosimilar fields in every file in the application.

Building Relational Tables � Defining Columns

Given the information from the COBOL file definition,augmented as described above, it is extremely easy to defineSQL tables. Selecting the <new table> option in the Tablespull-down list allows one to enter a new table name. An emptygrid of columns is then displayed. In the example we define atable “AllProduct”. As this table will contain informationcommon to all products, regardless of whether they areavailable, backordered, or discontinued, in the file view wechoose the <no variant> list of all items. In this file grid, oneselects all the common items and drags them to the AllProducttable grid. A corresponding set of columns appears, using thedefault column names for each item.

See Liant on page 38...

(800) 828-7438 or (615) 386-3100 FAX: (615) 386-3135 Vol III, No. 1 January-March 1995 Btrieve Developer's Journal 30

Page 31: THE INDEPENDENT SOURCE OF NEWS AND INFORMATION …of BTI. fiThat™s why we built the Solution Network Š to give our customers access to the resellers, integrators, consultants and

Service Dispatch

Another group that charges for its time, but needs tools torespond quickly to calls for help, track warranty work, andequipment under coverage, are service firms like computer andcopier repair businesses. ServiceMagic is a Btrieve-based productthat already integrates with a number of accounting packages.

Job Costing/ Real Estate Management

To time and materials, we now add heavy constructionequipment and rental units. Construction businesses, real estatedevelopers, and those responsible for rental of residential,industrial and commercial real estate look to job costing and realestate management systems for their business needs. SkyLine:The Property Management System, from The Softa Group, Inc.,is a popular Btrieve-based product focused to this group.

Manufacturing

A distribution company normally sells what it buys. Amanufacturing company turns what it buys into something else tosell. Manufacturers need system to help plan that process. MAXMicroMRP is a Btrieve-based manufacturing package thatintegrates with some of the high-end accounting products.

Fund Accounting

Non-profit organizations have some accounting needs notmet by most of the better known packages. Some of these needsinclude financial reporting on time periods that have nothing todo with the agency’s own accounting calendar, and trackingencumbrances. Encumbrances are like payables on steroids; youmust account for what you spend when you commit to anexpense, with a purchase order, not when you receive the goodsor services (normal accrual based accounting) or pay for it (cashbased accounting).

Possibly the very first user of Btrieve, Micro AzaleaSystems, Inc. offers FundBalance Plus. Their modules includethe standard General Ledger, Accounts Receivable, and AccountsPayable, but also include somewhat more eclectic Utility Billing,Voter Registration, and Cemetery Management.

MIP Fund Accounting is an excellent system with strongreporting and control features that the high-end ASVs shouldemulate.

Point of Sale

From the eleemosynary endeavors to the hustle and bustle ofthe retail storefront, you need special software to run cashdrawers, pole displays, receipt printers, and track cash outs, floortraffic, and cashier performance. Point of Sale software, like thatfrom Synchronics, Inc. is designed for those needs. Synchronicsworks with many high-end Btrieve-based accounting packages.

Industry Specific

Btrieve has been a popular choice of many companies thatbegan their development from the source code that evolved fromMCBA. For example, The Freedom Group provides a packagespecifically for the Insurance industry based on the MCBA codeand Btrieve.

Accounting continued from page 32 RESOURCES FOR FINDING OUT MORE

The software marketplace changes quickly. Some namesendure and adapt to the changing marketplace quickly; somecome and go; and some new names are thrown into the pot,waiting for the trial of time. How can you keep up with themarketplace?

You can get independent and objective lists of the featuresand capabilities of popular software packages using a number ofsubscription-based evaluation and rating services. Each providescheck lists to help determine how different packages comparewith a list of needs and desires. Each approaches the processslightly differently. Some examples:

The Accounting Library, Version 3.0, from Solutions, 804-330-0000. 2444 Early Settlers Road, Richmond, VA 23235. Thesingle volume guide and included software lists the features of100 accounting software products, from shareware to high-end,using checklists prepared by the vendors and verified bySolutions. The Accounting Library is a veritable “consultant-in-a-box.”

Guide To Accounting Software For Microcomputers; Guideto Manufacturing Software for Microcomputers; otherspecialized guides. Computer Training Services, 800-433-8015.11708 Ibsen Drive, Rockville, MD 20852. The popular series ofevaluation guides from Sheldon Needle uses “independent”consultants to review and rate each guide’s products. The guidesprovide a set of checklists for you to review with your client.After keying the results of the questionnaires into the computer,the system produces a series of reports showing how each of thereviewed packages compare with the client’s responses. TheGuides then provide detailed information about each of thepackages for your client’s review.

Practitioners Publishing Company (PO Box 966, Fort Worth,Texas, 76101-9976, 800-323-8724) provides their “Guide toInstalling Microcomputer Accounting Systems” and “SoftwareCompare” software evaluation tool. Largely aimed at the PublicAccounting marketplace, the Guide provides extensive guidanceand checklists for running a computer consulting practice andinstalling the packages> They also provide tricks and tips in theuse of major accounting systems. The Software Compare followsclosely after The Accounting Library’s disk-based evaluationsystem.

There are also a number of on-line and cd-rom baseddatabases for quickly searching through the contents of recentcomputer literature. My favorite resource is Computer Selectfrom Ziff-Davis, 800-827-7889. Each CD-ROM disk hasapproximately 80,000 articles about computer-related productsand 75,000 product specifications that can be quickly searched tomeet almost any need. Do you want to find legal time and billingpackages that run on a Macintosh and cost less than $1,000? Youcan do it on Computer Select. Computer Select is available onCD-ROM a subscription basis, on-line through CompuServe, andmaybe at a library near you.

Once you have used the above tools to track down suitablesoftware, you may want to find objective reviews. For additionalfeedback on the products, look to the following periodicals foraccounting software reviews:

Accounting Technology, Eleven Penn Plaza, 17th Floor,New York, NY 10001. The CPA Software News, 1105 NorthBeard, Suite 200, Shawnee, Oklahoma 74801. PC Magazine, OnePark Avenue, New York, NY 10016. PC Magazine has an

31 Btrieve Developer's Journal Vol III, No. 1 January-March 1995 (800) 828-7438 or (615) 386-3100 FAX: (615) 386-3135

Page 32: THE INDEPENDENT SOURCE OF NEWS AND INFORMATION …of BTI. fiThat™s why we built the Solution Network Š to give our customers access to the resellers, integrators, consultants and

extensive bi-annual fall review of high-end off-the-shelfaccounting software and regular reviews of other businesspackages. The next high-end review should be on the shelf in thenext few months.

Looking for feedback from others involved in the accountingsoftware industry? You will find accounting software forums ona number of on-line services. On CompuServe, type GOACCOUNTING, for a forum of many different vendors, CPAsand others interested in asking or telling about product. TheInternet USENET group biz.comp.accounting is an example of avendor-independent forum for discussing these needs. Of course,the saying “Reading Usenet News is like shouting ‘Anybodywant to buy a used car?’ in a crowded theater.”

How about the chance to meet with others to see yourproducts hands-on and see the competition? A number ofconvention and seminar series are starting to tour the countryshowcasing accounting and business products. You will mostlikely see these advertised in some of the accounting publicationsmentioned above.

If you have selected an accounting package to developaround, the ASV probably has training or an annual dealer’smeeting. Developers will most likely be in attendance, andperhaps displaying their wares.

Finally, if the timing is right, you can immerse yourself inthe world of accounting software (and the sights of Arizona) atone of the accounting profession’s premier shows, MICRO95:The American Institute of Certified Public Accountants (AICPA)Microcomputer Technology Conference, June 4-7, 1995. Thisthree day conference is a showcase for computer technology andaccounting software. Call 800-862-4272 or 201-938-3232 formore information.

CONCLUSION

You can find Btrieve-based accounting products to meetalmost any need, and on which to build the foundation for yourown development. To keep up with the changes in the industry, anumber of resources are available to help you plan your course.

Low-End and Mid-RangeAccounting System Vendors

BusinessWorks 800-447-5700dbftrieve 612-835-1080One Write Plus 800-388-8000, 603-880-5100Freedom 800-FREEDOMFundBalance Plus 800-457-FUND, 313-677-0550M.Y.O.B. 201-586-2200Quicken, Quickbooks 800-781-6999, 415-322-0573Max/MicroMRP 415-345-6000MIP Fund Accounting 800-647-3863, 512-454-5004RaSQL 800-231-1293, 206-251-1900SBT 800-944-1000, 415-444-9900ServiceMagic 201-529-5533Simply Accounting 800-CALL-CAISkyline 800-445-7638, 708-291-4000SourceMate 800-877-8896, 415-381-1011Synchronics 800-852-5852TimeSlips 800-285-0999

TypConst: Help for the VB BtrieveDeveloper

by Will Fastie, ShopTec Systems, Inc.

I’ve stumbled over a very useful Shareware utility which should beof great interest to Btrieve developers using Microsoft’s Visual Basic forDOS or Windows. It’s called TypConst, and it plugs a hole created by aVB deficiency.

As any Btrieve developer knows, file creation usually involves thespecification of key segments. These specifications require both theoffset of the field in the record buffer and the length of that field. Aslong as you don’t expect the record layout to change, it’s easy enoughjust to code in the offset and length as numbers.

But development usually involves an iterative process of filedefinitions, so using “magic” numbers can be a problem. What’s neededis a way to define constants in VB that represent the offset and lengthvalues, constants which get updated automatically if the record structurechanges. Alas, VB provides no such facility.

TypConst comes to the rescue. This small Windows utility readsyour BASIC source looking for occurrences of Type definitions. It thencreates another file, which you can include in your BASIC project,which contains exactly the constants you need. This isn’t a perfectsolution because you still have to remember to run the program, but itbeats hand-coding all those constants.

If you have a type definition of the following form:Type Buddies

Tom As IntegerDick As String * 8Harry As Long

End Type

TypConst will create a BASIC source file which contains:Global Const ofsBuddies_Tom = 0Global Const lenBuddies_Tom = 2Global Const ofsBuddies_Dick = 2Global Const lenBuddies_Dick = 8Global Const ofsBuddies_Harry = 10Global Const lenBuddies_Harry = 4

TypConst allows a number of options regarding the generated code.The “ofs” and “len” prefixes may be suffixed instead. “Global” may beomitted. Offsets can be calculated from either 0 or 1. The type name(e.g., Buddies) can be omitted. The program can scan a list of specificfiles or every file in a VB .MAK project file.

TypConst is Shareware and is available from Editing ServicesCompany, P.O. Box 599, Plymouth, MI 48170, for $10. An extra $15buys the source; the program is written in Visual Basic and requiresMicroHelp Muscle to make the .EXE. Jim Mack, the author, can bereached at [email protected].

²

²(800) 828-7438 or (615) 386-3100 FAX: (615) 386-3135 Vol III, No. 1 January-March 1995 Btrieve Developer's Journal 32

Page 33: THE INDEPENDENT SOURCE OF NEWS AND INFORMATION …of BTI. fiThat™s why we built the Solution Network Š to give our customers access to the resellers, integrators, consultants and

Liant continued from page 35

Modifying SQL Data Types

In the table grid, one can modify the SQL column names,SQL column types, and other SQL column attributes. If theearlier described steps of removing common prefixes andrecognizing common data types have been followed, frequentlyno modification of the default SQL description is necessary.Tables on Arrays

The purpose of this database design is to enable Windowsfront-end tools to access COBOL data through ODBC. Toillustrate this capability, we will assume without going throughthe mechanics that two additional tables have been defined on theORDER-FILE. The ORDER-FILE is interesting, in that itcontains a repeating group of items in the order defined inCOBOL with an OCCURS DEPENDING ON construct. Todefine a normalized view of this order information, it isrepresented in SQL as two tables. The first table, Orders,identifies the order and provides information about the order.The second table, OrderItems, identifies each item in the order,especially product number and quantity. It is very important tonote that multiple rows in the OrderItems table can be generatedfrom a single COBOL record. As the COBOL record contains anitem OF-ITEM-COUNT that identifies the number of items in theorder, the Relativity Database Manager will use this field in eachrecord to identify the number of OrderItems rows to generate.Database Administration

The Relativity product provides a facility for defining usersand groups of users who are authorized access to the database.Each group of users can be granted authority to access individualtables and individual columns in tables. This privilege capabilityprovides security of sensitive data and a technique for givingdifferent people different views of one base table relation. Themechanics of assigning these privileges uses the same Windowsparadigms of selecting multiple items with the mouse andmoving them into the desired list.

Front-end Access to Tables

Numerous Windows applications now support ODBC accessto data. To illustrate the capabilities of these tools, in thisexample we will use Microsoft Query and Excel. Althoughmany of the ODBC-enabled applications are equivalent in theiruse of ODBC databases, the Microsoft suite is sometimes able toprovide unique capabilities because they include their own SQLengine in addition to the SQL engine in the ODBC databasemanager.

Using Microsoft Query

Microsoft Query provides a subset of the SQL capabilities ofMicrosoft Access on behalf of the Microsoft tools Word andExcel. When building a new query with Query, you are giventhe opportunity to select any of the ODBC datasources on thesystem. After choosing the datasource “Btrieve Example” andlogging on as BDJ, we are given a choice of tables to include inthe query.

After selecting the tables Orders, OrderItems, andAllProduct, Query displays the relationship between these tables.This illustrates the importance of removing file specific prefixesfrom the COBOL item names. Because the COBOL item namesOF-PRODUCT-NUMBER and PF-PRODUCT-NUMBER werechanged into the common column name ProductNumber, Querywas able to recognize the relationship between OrderItems andAllProduct without programmer intervention.

In this example, we will select the OrderNumber,OrderType, and TotalOrderValue from the Orders table, theOrderValue, ProductNumber, and Quantity from the OrderItemstable, and the PricePerUnit from the AllProduct table. In thisexample, AutomaticQuery is enabled so Query displays the dataimmediately. In order to illustrate Excel access, this query issaved as BDJ.QRY.

33 Btrieve Developer's Journal Vol III, No. 1 January-March 1995 (800) 828-7438 or (615) 386-3100 FAX: (615) 386-3135

Page 34: THE INDEPENDENT SOURCE OF NEWS AND INFORMATION …of BTI. fiThat™s why we built the Solution Network Š to give our customers access to the resellers, integrators, consultants and

Incorporating Data in Microsoft Excel

In Microsoft Excel, the Data, Get External Data dialogallows ODBC data to be imported into an Excel spreadsheetthrough Query. After Excel starts Query, we can select the querydeveloped above, BDJ.QRY. This query retrieves the same datadesigned above. The Query menu option, Return Data toMicrosoft Excel, allows this data to be returned to the Excelspreadsheet. All the functionality of Excel can now be applied tothe retrieved data. For example, one can construct a histogram ofthe quantity sold for each product.

Note that this need not be a one-time query. By saving thequery and the spreadsheet, you can execute the same queryagainst your COBOL data files whenever you wish. The ExcelData, Refresh Data menu option can be used to import yourcurrent COBOL data into the spreadsheet.Future Enhancements

The Relativity product has been available to the RM/COBOL market for six months, and general availability to theMicro Focus market is intended by mid-1995. Beyond extendingthe product breadth to multiple COBOL dialects, other productenhancements should be valued by Btrieve users.

Write access

Using ODBC to retrieve data from COBOL files solvesmany problems today. An even larger set of problems can besolved by providing the ability to modify COBOL files throughSQL INSERT and UPDATE operations. This is especially true ifthe INSERT and UPDATE operations can be synchronizedthrough the transaction capabilities of file systems such asBtrieve.

Working-storage, Btrieve key import

The initial Relativity product imports SELECT and FDinformation from COBOL programs. A different style ofCOBOL programming places all the COBOL data iteminformation in the WORKING-STORAGE SECTION. Anobvious product enhancement is to provide a method to associateWORKING-STORAGE record definitions with files.

This style of defining file record layouts in the WORKING-STORAGE SECTION is especially common among users ofBtrieve. Historically many applications access the Btrieve filesthrough a CALL level interface instead of through COBOL file I/O statements. The development of Relativity databases forCOBOL data in Btrieve would be more convenient if importationof data definitions from WORKING-STORAGE were combinedwith the importation of indexed key definitions from the Btrievefiles themselves. Today one must write dummy COBOLprograms with SELECT and FD statements that match theBtrieve files.

File import and export

This article described by example the process of importingCOBOL file definition information into a Relativity catalog.Once this has been done, what happens when the file recordlayouts are changed? Today the file information must be re-imported and the relational tables defined anew. Anotherobvious item for further product development is to provide theability to merge modified file definition information into adatabase definition. Some users will instead choose to use theDesigner and its export capability to maintain file definitions inthe Relativity catalog and generate COBOL FD descriptions.

Conclusion

The Relativity product enables retrieval of COBOL data inBtrieve files through ODBC today. With this ODBC access, awide range of Windows front-end tools can process data that hashitherto been inaccessible. The Relativity design process can beexpected to be even more convenient and easy to use in thefuture, and to provide access beyond data retrieval.²

(800) 828-7438 or (615) 386-3100 FAX: (615) 386-3135 Vol III, No. 1 January-March 1995 Btrieve Developer's Journal 34

123456789012345678901234567890121234567890123456712345678901234567890123456789012123456789012345671234567890123456789012345678901212345678901234567123456789012345678901234567890121234567890123456712345678901234567890123456789012123456789012345671234567890123456789012345678901212345678901234567123456789012345678901234567890121234567890123456712345678901234567890123456789012123456789012345671234567890123456789012345678901212345678901234567123456789012345678901234567890121234567890123456712345678901234567890123456789012123456789012345671234567890123456789012345678901212345678901234567123456789012345678901234567890121234567890123456712345678901234567890123456789012123456789012345671234567890123456789012345678901212345678901234567123456789012345678901234567890121234567890123456712345678901234567890123456789012123456789012345671234567890123456789012345678901212345678901234567123456789012345678901234567890121234567890123456712345678901234567890123456789012123456789012345671234567890123456789012345678901212345678901234567123456789012345678901234567890121234567890123456712345678901234567890123456789012123456789012345671234567890123456789012345678901212345678901234567123456789012345678901234567890121234567890123456712345678901234567890123456789012123456789012345671234567890123456789012345678901212345678901234567123456789012345678901234567890121234567890123456712345678901234567890123456789012123456789012345671234567890123456789012345678901212345678901234567123456789012345678901234567890121234567890123456712345678901234567890123456789012123456789012345671234567890123456789012345678901212345678901234567123456789012345678901234567890121234567890123456712345678901234567890123456789012123456789012345671234567890123456789012345678901212345678901234567123456789012345678901234567890121234567890123456712345678901234567890123456789012123456789012345671234567890123456789012345678901212345678901234567123456789012345678901234567890121234567890123456712345678901234567890123456789012123456789012345671234567890123456789012345678901212345678901234567123456789012345678901234567890121234567890123456712345678901234567890123456789012123456789012345671234567890123456789012345678901212345678901234567123456789012345678901234567890121234567890123456712345678901234567890123456789012123456789012345671234567890123456789012345678901212345678901234567123456789012345678901234567890121234567890123456712345678901234567890123456789012123456789012345671234567890123456789012345678901212345678901234567123456789012345678901234567890121234567890123456712345678901234567890123456789012123456789012345671234567890123456789012345678901212345678901234567123456789012345678901234567890121234567890123456712345678901234567890123456789012123456789012345671234567890123456789012345678901212345678901234567123456789012345678901234567890121234567890123456712345678901234567890123456789012123456789012345671234567890123456789012345678901212345678901234567

Page 35: THE INDEPENDENT SOURCE OF NEWS AND INFORMATION …of BTI. fiThat™s why we built the Solution Network Š to give our customers access to the resellers, integrators, consultants and

members and of the other developers in my own company I didmanage to learn enough about using Btrieve to come up with ausable replacement built upon it.

The replacement made me a near-instant convert to Btrieveas the record manager of choice for virtually every need.Maintenance of the data changed from a round-the-clockheadache to something needed only occasionally. Even comingup with tools that could convert users� existing file sets into thenew format my Btrieve-based version employed was a breeze.In the years since then, I�ve used the package for many purposesin addition to its obvious role in database management. Forinstance, one part of a current application uses a Btrieve file tomaintain its queue of jobs waiting to be sent out via FAX!

At the same time I was doing all this, I was working nightsand weekends as part of the writing team that put togetherUndocumented DOS, and I immediately envisioned a book onBtrieve as being my next publishing project. Unfortunately, Icouldn�t interest anyone else in the idea at that time. Mostpublishers, in fact, didn�t even seem to know what Btrieve was,while those who did know claimed that the book�s potentialmarket would be far too small to justify the investment of timeand money required to make a book happen.

So the Btrieve book went to the back of my mind while Iworked on a number of other projects, all but one of which didbetter than the publishers had expected. As my reputation as asort of technical investigative reporter (specializing indocumenting the undocumented) grew, so did my hopes ofgetting someone seriously interested in the Btrieve project. Afterall, Novell had steadfastly refused to divulge any details of theinternal structures, so almost everything about any Btrieve fileremained �undocumented� and likely grist for my mill. Myproposals emphasized this approach, rather than the generic�How To Use Btrieve� theme, with increasing emphasis as theyears passed by.

Finally, this past summer, after Btrieve Technologies re-acquired rights to the package from Novell and begancampaigning to restore public confidence in the programs, PhilSutherland at Addison-Wesley expressed tentative interest in theidea. Addison-Wesley�s accountants had reason to know me; allbut one of my books published from 1990 to date have comefrom that publisher. After announcement of the Microsoft-BTIagreement to bundle the NT server with Microsoft�s serverpackage, Phil became downright enthusiastic. Negotiations wererapid; I eagerly signed the contract and work began in earnest.

One of my first research steps was to contact Doug Reilly,whose knowhow I had come to respect greatly through contactwith him on CompuServe. Doug put me in contact with theother Doug, Doug Woodward, Btrieve�s original architect andits prime director for the product�s entire existence. And that�swhen the totally unexpected thing happened.

In my years of digging out undocumented details aboutDOS, I had become accustomed to having to work around layerupon layer of bureaucratic interference to get any usefulinformation. Most details could be discovered only by laboriousdisassembly, a process of educated guessing, lots of failedexperiments, and uncounted hours of assistance from other like-minded individuals. But as soon as I met Doug Woodward andtold him what I had in mind, he offered total cooperation and

Book continued from page 8direct access to all the key personnel in the company.

That cooperation not only made this book the easiest oneI�ve yet done, it also made it one of the most enjoyable to workon. Being able to confirm my discoveries just by picking up thephone and talking directly to the person who wrote that part ofthe program added a whole new dimension of depth, and, I amcertain, has made this book more accurate than any I�vepublished before.

Midway through the effort, Phil Sutherland moved to a newjob at another publishing house, and Kim Fryer had to step intothe gap and take over the project. She did so admirably, and Ihave nothing but praise for the way she rose to the challenge. Ilook forward to doing more books under her direction in thefuture. Who knows, we might even come up with somethinglike �Btrieve II� if you find this first effort useful enough!

About the author...An unabashed hacker since 1967 and a desktop-system

programmer since 1981, Jim Kyle is Director of ResearchProjects at ARI in Oklahoma City, OK, and develops graphicssoftware and programming tools when he�s not writing aboutthem. He�s also a contributing editor for Windows TechnicalJournal, and primary administrator of Software Developmentmagazine�s forum on CompuServe. You can reach him viaCompuServe as 76703,762, or on the Internet [email protected].

35 Btrieve Developer's Journal Vol III, No. 1 January-March 1995 (800) 828-7438 or (615) 386-3100 FAX: (615) 386-3135

One might expect that the system most widely usedfor storage and rapid retrieval of data would be familiarto anyone in the desktop computing industry. Onewould be wrong.

That system, Btrieve, is the foundation for seven ofthe top ten professional accounting systems. What’smore, it forms the backbone of countless other softwarepackages in widespread use. Yet at a recent meeting ofleading Btrieve developers, the most common complaintvoiced was that their customers, and their managersalso, had absolutely no idea what Btrieve really does.

Because of this lack of comprehension, thedevelopers were under severe pressure to abandon theirmost reliable tool. Managers were insisting that theyconvert all applications to run under a more popularDBMS such as Oracle, Paradox, or dBase IV. Althoughsuch action would greatly increase resourcerequirements and at the same time reduce accuracy andreliability, executives and customers alike remainblissfully unaware of such facts.

The purpose of this book is twofold: one goal is toprovide the developer and the system administrator withample information to let them take full advantage of thepower inherent in the Btrieve system. The other is tobreach the veil of ignorance concerning just whatBtrieve is and what it does, thus helping developerseducate their customers and their managers...

Btrieve Complete, Chapter One...

Page 36: THE INDEPENDENT SOURCE OF NEWS AND INFORMATION …of BTI. fiThat™s why we built the Solution Network Š to give our customers access to the resellers, integrators, consultants and

curPat=0; pageProcessed=0L;

printf("\n%6ld pages processed",pageProcessed); /* now we are set up with the proper PP page is in ppBuf */ do { for ( loop=8 ; loop<pageSize ; loop+=4 ) { tlong1=(long *)&ppBuf[loop]; tptr=(char *)&ppBuf[loop]; /* is this a data page? */ if ( (tptr[1]=='D') ) { /* is this page assigned? */ tbuf[0]=tptr[2]; tbuf[1]=tptr[3]; tbuf[2]=tptr[0]; tbuf[3]=0; tlong1=(long *)&tbuf[0]; if ( *tlong1!=0 ) { fseek(in,(pageSize*(*tlong1)),SEEK_SET); fread(pageBuf, curFcr->pgSz, 1, in); processDataPage(curFcr,out,pageBuf); pageProcessed++; printf("\r%6ld pages processed",pageProcessed); } } } curPat++; if ( (curPat<numPats) ) { fseek(in,(pageSize*(long)pagesPerPat)+4L,SEEK_SET); fread(ppBuf, curFcr->pgSz, 1, in); fread(pageBuf, curFcr->pgSz, 1, in); tlong1=(long *)&ppBuf[4]; tlong2=(long *)&pageBuf[4]; /*if usage count of the second page is greater than the first use it as ppBuf*/ if ( (swaplong(*tlong2))>(swaplong(*tlong1)) )

memcpy(ppBuf,pageBuf,pageSize); /* now we are once again set up with the ppBuf pointing to the correct PAT page */ } else

done=1; } while ( !(done) ); printf("\n\nDONE!"); free(ppBuf); free(pageBuf); return(0);

}

long filelen(FILE *t){ long loc; long begloc;

errno=0; /* get the current position, seek to the end, save that location, then seek to the original position. */ if ( (begloc=ftell(t))==-1L || (fseek(t,0L,SEEK_END))!=0 || (loc=ftell(t))==-1L || (fseek(t,begloc,SEEK_SET))!=0 ) return(0L); return(loc);}

long swaplong(long orig){ char *t; char dest[10]; long *pl; t=(char *)&orig; dest[0]=t[2]; dest[1]=t[3]; dest[2]=t[0]; dest[3]=t[1]; pl=(long *)&dest[0]; return(*pl);}

void usage(void){ printf("\nUSAGE: SALVAGE <Btrieve file> <BUTIL format file>\n"); printf("\n Fixed length Btrieve files only, no encryption");}

void processDataPage(struct FCRPAGE *curFcr,FILE *out,char *pageBuf){ int loop;

/* we step through the page buffer by physicalRecLen bytes. */ for ( loop=6 ; loop<curFcr->pgSz ; loop+=curFcr->physicalRecLen ) { if ( (pageBuf[loop]!=0 || pageBuf[loop+1]!=0) ) { fprintf(out,"%d,",curFcr->logicalRecLen); fwrite(&pageBuf[loop+2], curFcr->logicalRecLen, 1, out); /* terminate the line consistant with BUTIL standard */ fprintf(out,"%c%c",0x0D,0x0A); } }}

SALVAGE.C continued from page 28...

36 Btrieve Developer's Journal Vol III, No. 1 January-March 1995 (800) 828-7438 or (615) 386-3100 FAX: (615) 386-3135

123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123123456789012345678901234567890121234567890123456789012345678901212345678901234567890123456789012123