FABS - Qbasic
#8
Hello,
I'll explain. I haven't been able to get FABS to work with QB64. Only with QB45, and on Windows XP, Vista and Windows 7 32-bit.
What FABS does is create a key file for each table, and you create the data file on your own. When you insert a new data, it adds it to your key file and tells you which position in your data file to save it to. When you look for that data, FABS tells you in which position you saved it.
There are 2 ways to use FABS. One is the one you mention, that the program is compiled with a library, and another is the one I used, since I didn't have that library.
I'll tell you how I used it:
Before loading your program you have to load the FABS.COM file. What it does is stay in memory and write a file called FSEG with 8 digits, in which it indicates in which memory address it has been loaded, so that your program can access it.
In the first line of the program you have to put:

DECLARE SUB fabs (cmnd$, recno, fseg, errf%, adrkey%)
OPEN "FSEG" FOR RANDOM AS 1 LEN = 8:
FIELD 1, 8 AS dd$
GET 1, 1
fseg = VAL(dd$)
CLOSE 1

Then comes the corresponding program and this would be the way to use it:
For example, to search for a code an article....

We first open the files:
OPEN "ARTICLE.DAT" FOR RANDOM SHARED AS 1 LEN = 24
FIELD 1, 4 as code$, 20 as name$
cmnd$ = "O\ARTICLE.KEY\1"
CALL fabs(cmnd$, recno, fseg, errf%, adrkey%)

Now we do the search:
cmnd$ = "G\1\1\" + article$
CALL fabs(cmnd$, recno, fseg, errf%, adrkey%)
IF errf% THEN
      PRINT " THERE IS NO ARTICLE WITH THAT CODE ";
    ELSE
      GET 1, recno
      PRINT "CODE:"; code$
      PRINT "NAME:";name$
END IF

The FABS routine would be this:

SUB fabs (cmnd$, recno, fseg, errf%, adrkey%)
    '------------------------------------ FABSP ROUTINE ---------------- ----------------
    DEF SEG = fseg
    offset% = &H8
    CALL ABSOLUTE(cmnd$, errf%, recno%, adrkey%, offset%)
    rnlo = recno%: IF rnlo < 0 THEN rnlo = rnlo + 65536
    cmnd$ = "X"
    CALL ABSOLUTE(cmnd$, dum%, recno%, dum%, offset%)
    rnhi = recno%: IF rnhi < 0 THEN rnhi = rnhi + 65536
    recno = rnlo + rnhi * 65536
    DEF SEG
END SUB

I don't know if this can help you.
Maybe Pete can convert to QB64 so that it works in this language as well.
Reply


Messages In This Thread
FABS - Qbasic - by G43 - 05-25-2022, 01:47 PM
RE: FABS - Qbasic - by JuanjoGomez - 05-26-2022, 12:01 PM
RE: FABS - Qbasic - by G43 - 06-14-2022, 04:50 PM
RE: FABS - Qbasic - by G43 - 06-14-2022, 04:52 PM
RE: FABS - Qbasic - by Pete - 06-14-2022, 05:04 PM
RE: FABS - Qbasic - by G43 - 06-15-2022, 06:47 PM
RE: FABS - Qbasic - by Pete - 06-15-2022, 07:07 PM
RE: FABS - Qbasic - by JuanjoGomez - 06-15-2022, 08:09 PM
RE: FABS - Qbasic - by JuanjoGomez - 06-15-2022, 08:14 PM
RE: FABS - Qbasic - by mnrvovrfc - 08-12-2022, 08:29 AM
RE: FABS - Qbasic - by bplus - 06-15-2022, 08:45 PM
RE: FABS - Qbasic - by JuanjoGomez - 06-16-2022, 10:56 AM
RE: FABS - Qbasic - by JuanjoGomez - 06-16-2022, 07:19 PM
RE: FABS - Qbasic - by G43 - 06-17-2022, 06:18 PM
RE: FABS - Qbasic - by G43 - 08-11-2022, 05:31 PM
RE: FABS - Qbasic - by JuanjoGomez - 08-12-2022, 06:08 PM
RE: FABS - Qbasic - by G43 - 08-11-2022, 05:43 PM
RE: FABS - Qbasic - by JuanjoGomez - 08-12-2022, 05:58 AM
RE: FABS - Qbasic - by mnrvovrfc - 08-12-2022, 08:41 AM
RE: FABS - Qbasic - by JuanjoGomez - 08-12-2022, 05:49 PM
RE: FABS - Qbasic - by JuanjoGomez - 08-12-2022, 05:52 PM
RE: FABS - Qbasic - by G43 - 08-15-2022, 01:25 PM
RE: FABS - Qbasic - by JuanjoGomez - 08-17-2022, 07:07 AM
RE: FABS - Qbasic - by G43 - 08-17-2022, 01:51 PM
RE: FABS - Qbasic - by JuanjoGomez - 08-17-2022, 02:29 PM
RE: FABS - Qbasic - by TempodiBasic - 10-10-2022, 11:06 AM



Users browsing this thread: 11 Guest(s)