home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Black Box 4
/
BlackBox.cdr
/
database
/
bhlp18.arj
/
BTRHELP.DOC
< prev
next >
Wrap
Text File
|
1991-03-01
|
43KB
|
1,181 lines
BTR HELP!
A File Maintenance Utility for Btrieve
Version 1.85
By David Smith
(c) 1991 Informative Technologies
1718 M Street NW, Suite 292
Washington, D.C. 20036
Voice (202) 675-4528
FAX (202) 675-4529
CompuServe 71311,2334
INTRODUCTION
Btrieve is Novell's record-manager system designed to aid PC programmers
in the development of applications. BTR HELP! is a file maintenance
utility for software developers who use Btrieve.
Integrating Btrieve into applications is time-consuming and tedious.
BTR HELP! was created to provide functions needed during the design,
development, and maintenance of Btrieve applications.
Some of the features of BTR HELP! are:
o A File Rebuilder for damaged Btrieve files.
o Tests the integrity of Btrieve files.
o Unloads Btrieve and shows the version loaded.
o Browse and delete records from a Btrieve file.
o Browse and edit records in HEX or ASCII format.
o Displays Btrieve file statistics.
o Supports text modes 100x60, 80x60, and 80x43.
o Clones Btrieve files.
o Lists File Operations, Key Types, and Error Codes.
o Full Mouse Support.
o Executes functions from batch files.
BROWSE
This option allows you to browse a Btrieve file and select records. You
can select records with the mouse or with the arrow keys.
EDIT
Positioning the highlight bar over a record and selecting 'E' allows
you to edit the record. You are able to edit the file in HEX or
ASCII. To switch between editing in HEX or ASCII, press the TAB key.
HEX values show on the left of the window and ASCII on the right.
If the entire record does not display in the edit window press PgDn
or PgUp to see the rest of the Btrieve record. The record will be
saved as you edit it.
DELETE
Positioning the highlight bar over a record and selecting
'D' allows you to delete the record.
KEY
Pressing the 'K' key allows you to change the key path that you are
browsing on.
UNDO
If you want to undo the changes that you have made, you are given
the chance to after you are through browsing. Or you can press 'U'
to undo the changes immediately.
COMMIT
Pressing 'C' causes the changes that you made to the btrieve file
to become permanent.
EXIT
Pressing 'X' causes you to exit the browse menu.
MODE
Pressing 'M' allows you to select the way the records are displayed
when you are browsing them. Selecting 'K' from this menu displays
the records by the key segments for the current browse key.
Selecting 'A' displays the records by their ASCII characters.
Selecting 'H' displays the records in HEX format.
SEARCH
TEXT
This option allows you to do a text search on the file. Text
is searched in the format as it is shown on the screen. If you
are currently displaying the file in ASCII mode, the raw data
in the file will be searched. If you are displaying the records
in the file in key mode, the formatted keys will be searched.
The search begins with the record following the current one
highlighted on the screen. The records are searched in key
order along the currently displayed key path.
--------------------------------------------------------------
Example 1
To find a certain hex string in a file:
1. Switch the browse mode to HEX BROWSE.
2. Enter the hex values as the search text.
(FF 43 52 33 - for example)
Notice the spaces between each byte. You must enter the
values you wish to search for in the same format as they
are displayed on the screen.
--------------------------------------------------------------
Example 2
To find the text 'SMITH' that could be any place in a record:
1. Switch the browse mode to ASCII BROWSE.
2. Enter 'SMITH' as the search text.
--------------------------------------------------------------
Example 3
To find the text 'SMITH' that could be ONLY a part
of key 3 when it is formatted for the display:
1. Switch the browse mode to KEY BROWSE.
2. Set the key path to 3.
3. Enter 'SMITH' as the search text.
In all cases, the text you are searching for must be
visible for the current KEY and BROWSE MODE.
--------------------------------------------------------------
PARAMETERS
This option allows you to select the text search parameters.
Case Sensitive
If case sensitive is set to 'YES', Btr Help! differentiates
between uppercase and lowercase when performing text searches.
Search Degree
This selects how exact the match must be when performing a
fuzzy text search. A setting of '0' means an exact match is
requested. A setting of '1' means there can be a one
character difference between the search text and text
that matches in a record. Setting the search degree to any
number 'N' means there can be a 'N' character difference
between the search text and the matching text in a record.
Search Search Btrieve
Degree Text Text Result
------ ------ -------- --------
0 SMITH SMITH Matches
1 WILLIAMS WILIAMS Matches
1 BALLOON BABOON No Match
2 BALLOON BABOON Matches
2 DRIVE ALIVE Matches
8 SUNSHINE MISSILES Matches
1 FF 3E 55 C0 FF 3E 54 C0 Matches
1 FF 3E 55 C0 FF 54 3E C0 No Match
2 01/19/1990 01/22/1990 Match
ADD
This option allows you to add records to a Btrieve file. The btrieve
file record can be entered in ASCII or HEX format. Pressing the TAB
key switches between editing in HEX and ASCII format. If the entire
record does not display in the edit window press PgDn or PgUp to
see the rest of the Btrieve record. When you are through editing
the record, press the ESC key. The record will be saved as you
edit it. If you do not want to add the record that you have entered,
you may press 'U' to UNDO the add. You are able to edit records up
to 64K in size.
HOLD
This menu option saves the physical location of the currently
highlighted record. After you have saved the currently highlighted
record, you can page through the file or change the current key
because HOLD has saved the location of the record in the file.
Selecting GOTO DIRECT will then take you back to the record.
GOTO DIRECT
The option takes you directly to a record. This uses the Get Direct
function to go directly to a record at a physical location in the
file. Enter the decimal number representing the offset of the record
into the file. This command also works in conjunction with the HOLD
command.
LOCK
The highlighted record is locked and is not available to other
stations. NOTE: If you are using transaction processing the entire
file is locked while you edit it. The LOCK menu option is only
available if you are not using transaction processing.
FILE OPTIONS
CLONE A BTRIEVE FILE
This option allows you to make an exact duplicate of a btrieve file.
The file you create will not contain any records. The clone Btrieve
file will have the same file structure as the original Btrieve file.
EMPTY FILE
This option will remove all records in a Btrieve file. It removes
all the records by creating a clone btrieve file of the selected
original file. Then it deletes the original btrieve file and
renames the clone btrieve file to the name of the original file.
ADD RECORDS
This option allows you to add records to a Btrieve file.
Records can be entered in ASCII or HEX format. Pressing the TAB key
switches between editing in HEX and ASCII format. If the entire
record does not display in the edit window press PgDn or PgUp to
see the rest of the Btrieve record. When you are through editing
the record press the ESC key. The record will be saved as you edit
it. If you do not want to add the record that you have entered,
you are given the chance to after you are through editing the
record.
STATISTICS
This option displays the statistics on a Btrieve file in a
scrollable window. Press PgUp or PgDn to view the file information.
This option displays the number of records in a file, the number of
unique key values stored for each index in the file, and the number
of unused pages in the file. The "Space Utilization" shows the
amount of space in the ^Btrieve^ file that is actual data. The
"Space Per Record" is the average number of bytes needed for each
record in the file (including indexes). Also shown is the file path
if you Extend a Btrieve file.
MISCELLANEOUS
RESET BTRIEVE
This option performs the Btrieve (28) RESET operation. This
operation aborts any transactions the station has pending, releases
all locks, and closes any open files for the station.
LOAD BTRIEVE
This will load Btrieve without exiting BTR HELP!. If Btrieve is not
loaded when BTR HELP! begins, BTR HELP! attempts to load it. If you
would like to load Btrieve with different options you will have to
unload Btrieve first. This option loads Btrieve with the options
specified on the configuration screen. It is recommended that you
load Btrieve before starting Btr Help!. Loading Btrieve from within
Btr Help! can sometimes cause problems.
UNLOAD BTRIEVE
This will remove Btrieve from memory, close all open files at this
station, abort any transactions, and release all locks held by the
station.
BTRIEVE VERSION
This shows the Btrieve type, version, and revision.
CONFIGURATION
This option allows you to change various program settings. You can
choose SAVE SETTINGS to save the program options after they have
been set.
TOGGLE SCREEN SIZE
This option changes the number of lines on the screen from 25 to 43
if you have a EGA adaptor or from 25 to 50 if you have a VGA adaptor.
SAVE SETTINGS
This menu option saves the current program settings. Some settings
do not take effect until Btr Help! is reloaded. The settings
are saved in a file called BTRHELP.CFG. This file is located in
the same directory as BTRHELP.EXE.
CONFIGURATION
This menu option allows you to change various program settings. Some
settings will take effect as soon as you leave the configuration window.
Other settings will not take effect until the settings are saved and the
program is reloaded. These settings are overridden by the command line
settings.
DATA BUFFER SIZE
This is the maximum data record length that can be passed to or from
Btrieve. The Maximum Record Length on the file server should match
this value if you are using a server based Btrieve. Also BREQUEST
will need to be loaded with the /D: parameter matching this setting.
BROWSE MODE
This is the default browse mode setting. It can be set to ASCII,
KEY, or HEX.
BTRIEVE AUTOLOAD
This option allows you to select how Btrieve is loaded
after Btr Help! is loaded. There are four options.
BTRIEVE - Loads BTRIEVE.EXE with its command line options.
BREQUEST - Loads BREQUEST.EXE with its command line options.
BOTH - Attempts to load BTRIEVE.EXE and if that fails it
then tries to load BREQUEST.EXE.
NONE - Does not try to load BTRIEVE or BREQUEST.
BIOS SCREEN WRITES
If this option is set to 'YES', the text displayed on the screen
will use BIOS writes instead of direct writes for greater
compatibility. If this option is set to 'NO', the screen
updates will be much faster.
MONOCHROME COLORS
This option causes the screen to use monochrome colors.
CLEAR BACKGROUND
If you select 'YES', the screen background will be cleared using
solid block character. If you select 'NO', the background will not
be cleared.
SPACE FOR BTRIEVE
This is the amount of space need to load BTRIEVE.EXE or
BREQUEST.EXE from within Btr Help! in bytes.
To determine this value:
1. Go to the dos prompt.
2. Run CHKDSK.EXE to determine the amount of free memory.
3. Load BTRIEVE.EXE with the parameters you wish to use.
4. Run CHKDSK.EXE again.
5. Subtract the free memory in step 4 from step 2.
6. Add 10K to the number.
This gives you space needed to load btrieve.
BREQUEST LOAD PARAMETERS
These are the options used to load BREQUEST.EXE from within
Btr Help!. If Btrieve is not loaded when Btr Help! begins,
Btr Help! attempts to load it. If you would like to load Btrieve
with different options you will have to unload Btrieve first.
USE LOG FILE
If this option is set to 'YES', the results of File Integrity and
File Rebuilder will be written to a file called BTRHELP.LOG. This
file is located in the same directory as BTRHELP.EXE.
EMS VROOM
If this option is set to 'YES', Btr Help! will check for the
presence of expanded memory and use it for the overlays needed by
the program. If you set this option to 'NO', Btr Help! will not
use expanded memory for overlays.
EXT VROOM
If this option is set to 'YES', Btr Help! will check for the
presence of extended memory and use it for the overlays needed by
the program. If you set this option to 'NO', Btr Help! will not use
extended memory for overlays. The use of extended memory is not
standardized and other programs that use extended memory may
conflict with Btr Help!.
ALLOW ESC KEY
If this option is set to 'YES', Btr Help! will allow the ESC key
to be pressed to abort File Integrity or File Rebuilder. You may
want to set this option to 'NO' if you do not want the file
rebuild interrupted or if you are rebuilding files from within a
batchfile.
UNLOAD BTRIEVE
If this option is set to 'YES', Btr Help! will unload Btrieve when
you exit Btr Help!. Btr Help! will always unload Btrieve if
Btr Help! loads it. Set this option to 'YES' if you load Btrieve
before you start Btr Help! and you want Btrieve unloaded when
Btr Help! ends.
TRANSACTIONS
If this option is set to 'YES', Btr Help! will allow the use of
transaction processing when you edit a file. This allows you to undo
changes that you make to the file. If you do not start Btrieve with
transaction processing on, you will want to set this option to 'NO'.
43/50 LINE MODE
If this option is set to 'YES' and you are using a EGA or VGA
monitor, Btr Help! will display more lines on the display. 43
for a EGA monitor and 50 for a VGA monitor.
SHADOWED WINDOWS
If this option is set to 'YES', Btr Help! will display shadows on
the program windows.
OWNER
If all of your Btrieve files use the same owner name you may want
to put the owner name here. Btr Help! will use it as the default
for accessing all files.
BTRIEVE LOAD PARAMETERS
These are the options used to load Btrieve from within Btr Help!.
Btr Help! attempts to load Btrieve if it is not loaded when Btr Help!
is started. Btr Help! uses these parameters to load Btrieve.
FILE SPECIFICATION
The file specification determines which files are displayed in the
browse or which file Btr Help! performs its functions on. If the
file specification is not given then the default is '*.*' which
selects all file names.
FILE INTEGRITY
These options allow you to check the integrity of the key paths in a
Btrieve file. These options will determine if a Btrieve file's key
paths have been corrupted. If the key paths are corrupted you will
have to use the file rebuilder to repair the Btrieve file.
FILE ERRORS INTEGRITY
All the key paths in the file are traversed from beginning to end
and then from the end to the beginning. Checking the integrity will
show if any Btrieve errors occurred during the traversal of all of
the key paths.
FILE LINKS INTEGRITY
All the key paths in the file are traversed. A check is made to
make sure that the forward link for each record points to the same
record that has a reverse link pointing to it.
Good links:
A -> B -> C -> D -> E "Forward Links"
A <- B <- C <- D <- E "Reverse Links"
An example of corrupted links:
A -> C -> B -> A ->... "Forward Links"
A <- C <- D <- E <- ... "Reverse Links"
Sometimes when key paths are corrupted, the pointer to the next
record will point to itself or point to some random record.
Checking the integrity will show if the key paths have been
corrupted in this way.
FILE REBUILDER
These are options to rebuild a damaged Btrieve files. If you get an
(2) I/O Error status code when you try to access a Btrieve file, then
the file probably needs to be rebuilt. You have four options;
Regular Rebuilder, Quick Rebuilder, and File Recovery are used to
recover records. Repair Header is used to fix damaged btrieve headers.
REGULAR REBUILDER
If you value your Btrieve file and it is damaged, try rebuilding a
copy of the file. Rebuild the file on the same drive as the damaged
Btrieve file. First, this option will create a new file with the
same Btrieve structure as the file you want to rebuild. Then the
program copies as many records as it can into the new file starting
from the beginning of the old file. If it encounters any problems,
it will try to copy records from the end of the file. When it has
copied as many records as it can into the new file, the old file
is deleted and the new file is renamed to the old file's name.
QUICK REBUILDER
This option only works with Btrieve version 5.1 or higher. It uses
the Get Next Extended and the Insert Extended to rebuild the file.
If you value your Btrieve file and it is damaged, try rebuilding a
copy of the file. Rebuild the file on the same drive as the damaged
Btrieve file. First, this option will create a new file with the
same Btrieve structure as the file you want to rebuild. Then the
program copies as many records as it can into the new file starting
from the beginning of the old file. When all of the records have
been copied into the new file, the old file is deleted and the new
file is renamed to the old file's name. Note: Quick rebuilder will
be "quickest" if it is using a server based btrieve. To rebuild
using a server based Btrieve with BREQUEST it will need to be
loaded with the settings: BREQUEST /D:54000. Also, the Maximum
Record Length on the file server will need to be changed to 54000.
After it is changed on the file server you will need to reload
Btrieve. 54000 was selected in this example for the maximum rebuild
speed. The maximum record size is selectable on the configuration
screen.
REPAIR HEADER
Rebuilding the header is not trivial. You can just as easily damage
a good file using this option as to repair a damaged file. This
option is used to repair a damaged Btrieve file header. It should
ONLY be used if:
(1) You receive a (2) I/O Error when opening the file.
(2) Incorrect or strange values are shown when you
display the statistics on the file key structure.
(3) You receive a (30) Not a Btrieve file error when
opening the file.
Rebuilding the header starts by replacing the damage header in the
btrieve file. It then makes modifications to the header based on the
number of possible data pages in the file. After repairing the
header, rebuild the file before you try to access the file. You
should only work with a copy of the damaged file. Even though it
is damaged you may want to keep a copy of the original damaged
file to try another repair method.
FILE RECOVERY
This option is for the most seriously damaged btrieve files. It
calculates every possible position a record could be in a file and
tries to extract the record and inserts the records into a new
btrieve file. Select START RECOVERY to recover the file with the
default parameters. Note: This method sometimes recovers more
records than were originally in the file. If you browse the
recovered file you will be able to see the extra records at the
start or end of a key path. This method may not be valid with
Btrieve versions greater than 5.1 because the file format may change.
PAGE OPTIONS
This is where you can select the starting and ending pages for
the file recovery. Normally you will not need to change these
settings. If you interrupt a rebuild, you can restart it by
setting the starting page as the page where the rebuild was
interrupted.
----------------------------------------------------------------
Example
For a file with 10,000 pages. You could break it into two
steps that could be run at night.
FIRST NIGHT Starting Page = 1 and Ending Page = 5,000
SECOND NIGHT Starting Page = 5,001 and Ending Page = 10,000
----------------------------------------------------------------
Preallocate Pages - This is the number of pages that will be
preallocated for the recovered records. If the file exists, this
option does not affect the file. The default setting is the
number of pages in the original file. Preallocating the pages
speeds the recovery process.
FILE OPTIONS
This is where you can select the file for the recovered records.
RECOVERY OPTIONS
Normally you will not need to change these settings.
Get Direct Key - This is the key value used to perform the
Get Direct operation to recover the records. The default setting
is -1. Some versions of Btrieve do not support using -1 as the
key for Get Direct operations. Btr Help! will determine if your
version of Btrieve supports -1 as the key. If it does not, it
will automatically switch to using 0 as the key. If Btrieve
does not support -1 as the key, you may not be able to recover
as many of the records.
Eliminate Blank Records - When this option is set to 'YES',
Btr Help! will not add records that are filled with all binary
0s it recovers from the damaged file. If this option is set to
'NO', blank records will be added if they are found. The default
setting for this option is 'YES'.
LISTS
This menu option lets you view lists of error codes, key types, and
file operations.
ERROR CODES
This is a list of all the Btrieve error codes and their
corresponding numbers. A nonzero status does not always mean
that an error occurred. If you get an END OF FILE error, it may
mean you may have just retrieved the last record for a key path.
If you move the highlight bar over an error code and press [ENTER]
or select one with the mouse, information about that error code
will be displayed. I have tried to include hints for why certain
errors occur when I can.
OPERATIONS
This is a list of all the Btrieve file Operations and their
corresponding numbers. If you move the highlight bar over a file
operation code and press [ENTER] or select one with the mouse,
information describing that file operation code will be displayed.
KEY TYPES
This is a list of btrieve key types and their corresponding numbers.
If you move the highlight bar over a key type and press [ENTER] or
select one with the mouse, information describing that key type will
be displayed.
COMMAND LINE ARGUMENTS
All command line arguments are optional.
BTRHELP FILESPEC -SWITCHES KEYS @FILE -O<OWNER>
FILESPEC File Specification
SWITCHES Switches -bhmstpux
KEYS Auto Keys
FILE Auto Keys File
OWNER File Owner
FILE SPECIFICATION
The file specification determines which files are displayed in the
browse or which file BTR HELP! performs its functions on. If the
file specification is not given then the default is '*.*' which
selects all file names.
SWITCHES
-b Uses BIOS for video writes. If your computer has
trouble displaying some of the windows on your
screen, use this switch. This assists with
incompatibility in the display.
-e Do not use expanded or extended memory for VROOM
overlays.
-h Displays files in 43/50 line mode.
-m Disables color. Runs program in monochrome mode.
-p Automatically types keys when the program begins.
See: Auto Keys
-s Disables clearing of the screen. Does not display
the solid background behind the program window.
-t Do not use transaction processing when deleting or
editing records.
-u Unload Btrieve when you quit the program.
-x Do not allow ESC to be pressed to abort File
Integrity or File Rebuilder.
AUTO KEYS
If the -p switch is selected on the command line, the next group of
characters is typed automatically when the program begins. The
symbol '!' acts as the enter key and '#' is the ESC key.
-------------------------------------------------------------------
Example
BTRHELP DATABASE.DBF -xp RR!###
In this example the 'R' key is pressed to rebuild the file
DATABASE.DBF. after the file is rebuilt the ESC keys cause the
program to end.
-------------------------------------------------------------------
If the group of characters to be entered contains a space character,
enclose the characters in quotes (").
AUTO KEYS FILE
The characters in this file are typed when the program begins. The
characters typed are treated just like auto keys.
FILE OWNER
Specifies the owner name for the files used.
-------------------------------------------------------------------
Example
BTRHELP -oDEPT1
-------------------------------------------------------------------
LIST OF FILES
BTRHELP.EXE Btrieve File Maintenance Program.
BTRHELP.HLP Help file for BTRHELP.EXE
BSTOP.BAT Batch file that uses BTRHELP.EXE to unload btrieve.
BREBUILD.BAT Batch file that uses BTRHELP.EXE to rebuild a
btrieve file.
BRESET.BAT Batch file that uses BTRHELP.EXE to reset btrieve.
BEDIT.BAT Batch file that loads BTRHELP.EXE to edit a
btrieve file.
BEMPTY.BAT Batch file that loads BTRHELP.EXE to empty a
btrieve file.
BTR.BAT Batch file that loads BTRIEVE.EXE.
SITELICE.DOC Site and distribution license information.
REGISTER.BAT Batch file that displays the registration form
screen. This is on the shareware version only.
REGISTER.DOC Registration information and Registration form.
NWSPAPER.BTR Sample Btrieve file to try the features of BTR HELP!
VENDOR.DOC List of disk vendor instructions.
README.DOC Installation Instructions
BTRHELP.DOC BTR HELP! Documentation
CONTEXT-SENSITIVE HELP
Pressing F1 at any time displays a help screen that relates to the
current context of the program. Use the PgUp/PgDn keys to display
the different pages of help text on the screen. Use the arrow keys to
move between cross-referenced items on the help screen and press
[ENTER] to select another help item.
NOTES
All software or service names mentioned are trademarks, servicemarks,
or registered trademarks of their respective holders.
TECHNICAL SUPPORT
There are several ways to contact the author:
1. Send EMAIL on CompuServe to David Smith #71311,2334
2. Send a FAX to (202) 675-4529
3. Leave a message at the Programmers Corner BBS for
David Smith #1082, BBS# (301) 596-1180
4. Leave a voice mail message at (202) 675-4528 for David Smith.
5. By mail to:
David Smith
Informative Technologies Corporation
1718 M Street NW, Suite 292
Washington, DC 20036
The Association of Shareware Professionals (ASP) wants to make sure
that the shareware principle works for you. If you are unable to
resolve a shareware-related problem with an ASP member by contacting
the member directly, ASP may be able to help. The ASP Ombudsman can
help you resolve a dispute or problem with an ASP member, but does
not provide technical support for members' products. Please write
to the ASP Ombudsman at 545 Grover Road, Muskegon, MI 49442 or send
a Compuserve message via email to ASP Ombudsman 70007,3536.
PROGRAM KEYS
CURSOR MOVEMENT
Arrow Keys Cursor Movement
Ctrl-Left Arrow Word Left
Ctrl-Right Arrow Word Right
Home Beginning of Field
End End of Line/Field
Ctrl-Home Beginning of First Field
Ctrl-End End of Last Field
Tab Next field
Shift-Tab Previous field
INSERTING AND DELETING
Ins Toggle Insert Mode
Del Delete Character at Cursor
Backspace Delete Character Left
Ctrl-Backspace Delete Word Left
Ctrl-T Delete Word Right
Ctrl-U Delete to End of Field
Ctrl-Y Delete to Last Field
OTHER EDITING KEYS
Enter Process Current Field
Ctrl-Enter or F10 Process All Fields
Ctrl-R Restore Field
ESC Abort Data Entry
SPECIAL KEYS
F1 BTR HELP! Help
Alt+S Shell to DOS.
Alt+D Debug Window.
Alt+X or ESC Quit BTR HELP!
Alt+F1 Toggle BIOS Screen Writes
BROWSE KEYS
Ctrl+Home Goes to the first record.
Ctrl+End Goes to the last record.
Esc Ends the browse.
Home Puts the highlight bar on the first
record on the screen.
End Puts the highlight bar on the last
record on the screen.
Ctrl+Right Arrow Pages forward through a record a screen
at a time.
Ctrl+Left Arrow Pages backward through a record a screen
at a time.
Up Arrow Scroll up one record.
Down Arrow Scroll down one record.
BTR 'C' LIBRARY
---------------
The BTR 'C' Library is available with the registered version of
Btr Help!. All the calls to the BTR 'C' LIBRARY reference btrieve
files by a handle (integer). This handle is returned when the file
is opened with the iBtrOpen function. The function BtrInitialize
should be called at the beginning of your program and iBtrCloseAll
should be called at the end of your program.
#include <stdio.h>
#include <btrieve.h>
void main( void )
{
int iNews;
BtrInitialize();
iNews = iBtrOpen("NWSPAPER.BTR", NULL, B_OPEN);
iBtrCall( iNews, B_GET_LOWEST, 1);
/* Application Code goes here.. */
iBtrClose( iNews );
iBtrCloseAll(); /* Close all Files still open */
}
char *BtrErrorCode(int iBtrError)
---------------------------------
Returns the string for a btrieve error code.
INPUTS
iBtrError - Error code number
RETURNS
String for a btrieve error code.
EXAMPLE
printf("Btrieve Error 10=%s\n", BtrErrorCode( 10 ));
char *BtrOperationCode(int iBtrOper)
------------------------------------
Returns the string for a btrieve Operation code.
INPUTS
iBtrOper - Btrieve Function code
RETURNS
String for a btrieve operation code.
EXAMPLE
printf("Operation 3 is %s\n",BtrOperationCode( 3 ));
int BtrOpen(char *sFile, void *acRecord, int iOpenType)
-------------------------------------------------------
Opens a btrieve file. Does a statistics function call on
the file. Stores the record size and key information.
Returns a handle (integer) to refer to the Btrieve file.
INPUTS
sFile........Btrieve file path and name
acRecord.....Pointer to btrieve record or NULL if you
want a record to be automatically
allocated for you.
iOpenType....Type of open for the btrieve file.
B_OPEN Regular btrieve open
B_OPEN_ACCELERATED Open Accelerated
B_OPEN_READ_ONLY Open Read Only
B_OPEN_VERIFY Open Verify for local DOS disks
B_OPEN_EXCLUSIVE Open Exclusive access to file
RETURNS
Btrieve file handle or 0 if an error occurs.
EXAMPLE
iBtr=BtrOpen("MAIL.BTR", &rMail, B_OPEN);
int BtrClose(int iBtrHandle)
----------------------------
Closes a the file and Deallocates data space used by it.
INPUTS
iBtrHandle....File handle (integer) that refers to the
file.
RETURNS
The Btrieve result status code of the close.
EXAMPLE
BtrClose(iBtr);
void BtrShowError( int iBtrHandle )
-----------------------------------
Displays a btrieve error on the screen. You will
probably want to modify this routine for your particular
user interface.
INPUTS
iBtrHandle...Btrieve file handle to display last
operation result.
RETURNS
Nothing
EXAMPLE
BtrShowError( iBtr );
int BtrCreate(char *sFile, FILE_SPEC *specs, int iKey)
------------------------------------------------------
Creates a btrieve file.
INPUTS
sFile........The file name supplied.
specs........The Btrieve specs to create the file.
iKey.........Create Status Key.
CHECK_EXISTS - Check if file exists on create.
NO_CHECK_EXISTS - Don't check if file exists.
RETURNS
The btrieve result status code of the create.
EXAMPLE
BtrCreate("TEMP.BTR",&FileSpecs, 0);
int BtrCall(int iBtr, int iFuncCode, int iKeyNumber)
----------------------------------------------------
Executes a function call on a file specified by iBtr.
INPUTS
iBtr.........Btrieve file handle
iFuncCode....Btrieve function code to execute
iKeyNumber...Key path to use
RETURNS
Btrieve result status of the function.
EXAMPLE
BtrCall(iBtr, B_GET_NEXT, 0);
int BtrFillKey(int iBtrHandle, void *sKeyField)
-----------------------------------------------
Fills a btrieve key field from a string.
INPUTS
iBtrHandle...Handle of btrieve file
sKeyField....String to load into the key field
RETURNS
FILE_NOT_OPEN if the handle is invalid, else it
returns 0.
EXAMPLE
BtrFillKey(iBtr, "NEW YORK");
int BtrFillKeyN(int iBtr, void *sKeyField, int iLength)
-------------------------------------------------------
Fills the key field from an array of length iLength.
INPUTS
iBtr........Handle of btrieve file
sKeyField...Address of bytes to load into the key field.
iLength.....Number of bytes to load
RETURNS
FILE_NOT_OPEN if the handle is invalid, else it returns 0
EXAMPLE
BtrFillKeyN(iBtr, rKeyStruct, sizeof(rKeyStruct);
int BtrSetRecordLength(int iBtr, int iRecordLength)
---------------------------------------------------
Sets the record length of a btrieve record.
INPUTS
iBtr.............Handle of btrieve file
iRecordLength....Size of the btrieve record.
RETURNS
FILE_NOT_OPEN if the handle is invalid, else
it returns 0.
EXAMPLE
BtrSetRecordLength(iBtr, sizeof(rMail));
int iBtrGetRecordLength(int iBtrHandle)
---------------------------------------
Returns the record length of the last record read.
INPUTS
iBtrHandle...Handle of the btrieve file.
RETURNS
0 if the handle is invalid, else it returns the record
length.
EXAMPLE
iLength = iBtrGetRecordLength( iBtr );
void BtrInitialize(void)
------------------------
Initializes btrieve and the data structures.
INPUTS
None
RETURNS
None
EXAMPLE
BtrInitialize();
long lBtrGetPosition(int iBtrHandle)
------------------------------------
Returns a long integer indicating the position of
the current record.
INPUTS
iBtrHandle...Handle of the btrieve file.
RETURNS
The position of the current btrieve record.
EXAMPLE
lPosition = lBtrGetPosition( iBtr );
int iBtrSetPosition(int iBtr, long lPosition, int iKey)
-------------------------------------------------------
Sets the position of the current record using a long int.
INPUTS
iBtr..........Handle of the btrieve file.
lPosition.....Position to set in the btrieve file.
iKey..........Key path to set the current positioning.
RETURNS
The btrieve result status for the B_GET_DIRECT call.
EXAMPLE
iBtrSetPosition(iBtr, lPosition, 0);
int BtrCloseAll(void)
---------------------
Closes all btrieve files that may be open.
INPUTS
None
RETURNS
0
EXAMPLE
int BtrCloseAll();
int BtrKeyInit(int iBtrHandle)
------------------------------
Fills a btrieve key field with nulls.
INPUTS
iBtrHandle........Handle of the btrieve file.
RETURNS
0 or FILE_NOT_OPEN if the handle is invalid.
EXAMPLE
BtrKeyInit( iBtr );
int BtrKeyMax(int iBtrHandle)
-----------------------------
Fills a btrieve key field with 0xFF.
INPUTS
iBtrHandle....Handle of the btrieve file.
RETURNS
0 or FILE_NOT_OPEN if the handle is invalid.
EXAMPLE
BtrKeyMax( iBtr );
char *BtrDataRecord(int iBtrHandle)
-----------------------------------
Returns a pointer to the btrieve data record given the
file handle.
INPUTS
iBtrHandle...Handle of the btrieve file.
RETURNS
Pointer to the btrieve data record.
EXAMPLE
prMail = BtrDataRecord( iBtr );
long BtrNumberOfRecords( iBtr )
-------------------------------
Returns a long integer containing the number of records
in a file when the file was opened. Does not reflect
any records added or deleted since the file was open.
INPUTS
iBtrHandle...Handle of the btrieve file.
RETURNS
The number of records in a btrieve file.
EXAMPLE
lRecords = BtrNumberOfRecords( iBtr );
void *BtrSpecRecord(int iBtrHandle)
-----------------------------------
Returns a pointer to the btrieve file specifications
for a btrieve file.
INPUTS
iBtrHandle....Handle of the btrieve file.
RETURNS
Pointer to the btrieve file specifications for a file.
EXAMPLE
Specs = BtrSpecRecord( iBtr );