FATS - Fast Access Tree System
Table of Contents
Programming Interfaces
MS-Basic for OS/2

MS-Basic for OS/2


 
Needed Object Files

Up to version 6.0 of the basic compiler all strings were administered in the data segment of the application. Starting from the version 7.0 the entire memory can be used by strings (compiler flag /Fs).

Therefore you must use the appropriate interface when linking with FATS.
You need the following object modules:

fats.objFATS for OS/2 16bit
fats_mb6.objMS-Basic interface for NEAR-strings, *or*
fats_mb7.objMS-Basic interface for FAR-strings (/Fs)

If you own the extended version of FATS, you can use the object module fatsx.obj instead of fats.obj to take advantage of the new functions.

 
Linking a MS Basic Program with FATS

To compile and link a application that calls FATS, use the following commands:

BC tst1eng6 /O /G2 /Fpi /Lp;
LINK tst1eng6 fats[x].obj fats_mb6.obj;

or Basic 7.x and Far-Strings:

BC tst1eng7 /O /G2 /Fpi /Lp /Fs;
LINK tst1eng7 fats[x].obj fats_mb7.obj;

 
Calling FATS

FATS commands are executed with the function FATSBASIC:

CALL FATSBASIC(CMND$, ERRORCODE%, RECNO&, KEYLEN%)

Parameter Usage:

CMND$Command string (input)
ERRORCODE%Errorcode (output)
RECNO&Record number, long integer
KEYLEN%Length of key value, integer

To call FATS, you will need the following subroutine in your program:

FATSCALL:
CALL FATSBASIC(CMND$, ERRORCODE%, RECNO&, KEYLEN%)
FATSKEY$ = SPACE$(KEYLEN%)
CALL FATSGETKEY( FATSKEY$ )
RETURN

The FATSBASIC subroutine does the actual call to FATS and returnes the length of a found key in the KEYLEN% variable. This value should be used to assign to the key string variable the value SPACE$(KEYLEN%). Until your application assigns some value to the string variable, it has a length of 0.
The FATSGETKEY subroutine copies the key value from the previous FATS call to the key string variable.

 
Testprograms

The FATS distribution disk for OS/2 contains some test programs in the directory OS2_16I\BASIC\MS that illustrate how you can use the FATS commands in your programs:

 tst0eng6.basMS-Basic (uses FABSMB)
 tst0eng7.basMS-Basic Version 7.0 (uses FABSMB3)
 tst1eng6.basMS-Basic (uses FATSBASIC)
 tst1eng7.basMS-Basic Version 7.0 (uses FATSBASIC)
 rebuild.basRe-Indexing a Data File (commands 'BK', 'DL')

The extended version of FATS contains the following additional test programs:

 tst2_eng.basIntroduction to the Matchcode Functions
 mcsort.basUse of the key-flag with command 'MC'
 reindex.basFast Re-Indexing with the command 'XB'

 
Compatible Programming Interfaces

You also can use the interfaces provided by the FABS PLUS modules. Please take notice of the additional information at pages  4-77, 9-77 and 9-77.

The following FABS interfaces are available:

FABSMBEntry Point in FATS.OBJ (NEAR-strings)
FABSMB3like FABSMB, however for Basic ver.7
(object file FATS_MB7.OBJ)


 

© 2008  GCS Software, Udo Gertz