FATS - Fast Access Tree System
Table of Contents
Programming Interfaces
QBasic (ab DOS 5)


The FATS Toolkit supports a calling interface that is 100% compatible with the program FABS-Plus Net of Computer Control Systems. All programming interfaces of this software were reproduced.

There is no need to change your source code. You just need to change obj-/dll files to use FATS in existing projects, for example in the MS-DOS environment you only have to replace the FABSP module with the FATS module.

The following Basic example demonstrates the use of the  FABS PLUS compatible commands:

10   PRINT "This Test Program was designed for the QuickBasic Interpreter (DOS5)"
20   PRINT
30   INPUT "Please press the [ENTER] key ...";X$
40   REM
50   REM  -------> FSEG / read FATS segmentaddress
60   REM
70   OPEN "I" , #1, "FSEG"
80   INPUT #1,FSEG
90   CLOSE #1
100  REM
110  REM  -------> open file with test data
120  REM
130  OPEN "R", #1, "..\..\..\DEMODATA\CUSTOMER.ASC", 105
140  FIELD #1,5 AS F1$,25 AS F2$,25 AS F3$,25 AS F4$,5 AS F5$,20 AS F6$
200  REM
210  REM  -------> create data file
220  REM
230  PRINT"Creating Data File ..."
240  OPEN "R", #2, "CUSTOMER.DAT", 128
250  FIELD #2,1 AS D1$,5 AS D2$,25 AS D3$,25 AS D4$,25 AS D5$,5 AS D6$,20 AS D7$
260  REM
270  REM  -------> create index file
280  REM
290  PRINT"Creating Index File ..."
300  CMND$="C\CUSTOMER.KEY\25\4\A\1"
310  GOSUB 2130
400  REM
410  REM  -------> insert records
420  PRINT
430  PRINT"290 records will be inserted into the data file."
440  PRINT"For each record 4 keys will be stored in the index file"
450  INPUT"Please press the [ENTER] key ...";X$
460  FOR X=1 TO 290
470    GET #1,X
480    LSET D1$=" "
490    LSET D2$=F1$
500    LSET D3$=F2$
510    LSET D4$=F3$
520    LSET D5$=F4$
530    LSET D6$=F5$
540    LSET D7$=F6$
550    CMND$="I\1\"+RTRIM$(D2$)+"\"+RTRIM$(D3$)+"\"+RTRIM$(D4$)+"\"+RTRIM$(D6$+D7$)
560    GOSUB 2130
570    IF FATSERR% <> 0 THEN 2030
580    PRINT D3$;" --> RecNo ";RECNO
590    PUT #2,RECNO
600  NEXT X
610  CLOSE #1
700  REM
710  REM  -------> print all customers, sorted in ascending order by NAME
720  REM
730  PRINT
740  PRINT"This list shows some fields from the Customer Table,"
750  PRINT"sorted in ascending alphabetical order on the Customer's"
760  PRINT"surname and forename."
770  INPUT"Please press the [ENTER] key ...";X$
780  CMND$="F\2\1"
790  GOSUB 2130
800  IF FATSERR% <> 0 THEN 920
820  GOSUB 2270
830  GET #2,RECNO
840  PRINT D3$;" --> RecNo ";RECNO
850  CMND$="A\2\"+STR$(RECNO)+"\1\"+FATSKEY$
860  GOTO 790
900  REM
910  REM  -------> print all customers, sorted in ascending order by JOB
920  PRINT
930  PRINT"Two columns - JOB and NAME are displayed, sorted in ascending"
940  PRINT"order by the JOB field."
950  INPUT"Please press the [ENTER] key ...";X$
960  CMND$="F\3\1"
970  GOSUB 2130
980  IF FATSERR% <> 0 THEN 1060
990  GET #2,RECNO
1000 PRINT D4$;" ";D3$;" --> RecNo ";RECNO
1020 CMND$="N\1"
1030 GOTO 970
1040 REM
1050 REM  -------> print list with records sorted by ZIP and CITY
1060 PRINT
1070 PRINT"Three columns - ZIP, CITY and NAME are displayed, sorted in"
1080 PRINT"descending order by ZIP then CITY."
1090 INPUT"Please press the [ENTER] key ...";X$
1100 CMND$="L\4\1"
1110 GOSUB 2130
1120 IF FATSERR% <> 0 THEN 2030
1140 GOSUB 2270
1150 GET #2,RECNO
1160 PRINT D6$;" ";D7$;" ";D3$;" --> RecNo ";RECNO
1170 CMND$="E\4\"+STR$(RECNO)+"\1\"+FATSKEY$
1180 GOTO 1110
2000 REM
2010 REM  -------> close index file
2020 REM
2030 CMND$="K\1"
2040 GOSUB 2130
2050 CLOSE #2
2060 SYSTEM
2100 REM
2110 REM *** Call FATS ***
2120 REM
2130 FTSQUICK%=8
2140 DEF SEG=FSEG
2150 CALL ABSOLUTE (CMND$,FATSERR%,RECLO%,ADRKEY%,FTSQUICK%)
2160 RECLO=RECLO% : IF RECLO<0 THEN RECLO=RECLO+65536!
2170 ADRKEY=ADRKEY% : IF ADRKEY<0 THEN ADRKEY=ADRKEY+65536!
2180 CMND$="X"
2190 CALL ABSOLUTE (CMND$,DUMMY%,RECHI%,DUMMY%,FTSQUICK%)
2200 RECHI=RECHI% : IF RECHI<0 THEN RECHI=RECHI+65536!
2210 RECNO=RECLO+RECHI*65536!
2220 DEF SEG
2230 RETURN
2240 REM
2250 REM *** SUB: get the return key value from FATS  ***
2260 REM
2270 FATSKEY$=""
2280 FOR X=ADRKEY TO ADRKEY+24
2290   DEF SEG=FSEG
2300   FATSI=PEEK(ADRKEY)
2310   DEF SEG
2320   FATSKEY$=FATSKEY$+CHR$(FATSI)
2330   ADRKEY=ADRKEY+1
2340 NEXT X
2350 RETURN
 

© 2008  GCS Software, Udo Gertz