|
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.obj FATS for OS/2 16bit fats_mb6.obj MS-Basic interface for NEAR-strings, *or* fats_mb7.obj MS-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.bas MS-Basic (uses FABSMB) tst0eng7.bas MS-Basic Version 7.0 (uses FABSMB3) tst1eng6.bas MS-Basic (uses FATSBASIC) tst1eng7.bas MS-Basic Version 7.0 (uses FATSBASIC) rebuild.bas Re-Indexing a Data File (commands 'BK', 'DL')
The extended version of FATS contains the following additional test programs:
tst2_eng.bas Introduction to the Matchcode Functions mcsort.bas Use of the key-flag with command 'MC' reindex.bas Fast 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:
FABSMB Entry Point in FATS.OBJ (NEAR-strings) FABSMB3 like FABSMB, however for Basic ver.7
(object file FATS_MB7.OBJ)
© 2008 GCS Software, Udo Gertz