"RETURN Without GOSUB"; Btrieve BTVRFAR Fails with Basic (42466)



The information in this article applies to:

  • Microsoft QuickBASIC 4.0
  • Microsoft QuickBASIC 4.0b
  • Microsoft QuickBASIC 4.5
  • Microsoft BASIC Compiler for MS-DOS and OS/2 6.0
  • Microsoft BASIC Compiler for MS-DOS and OS/2 6.0b
  • Microsoft Basic Professional Development System (PDS) for MS-DOS and MS OS/2 7.0

This article was previously published under Q42466

SUMMARY

Btrieve now has a procedure named BTRVFAR, which is intended to allow Btrieve to access variables outside of the near heap. This procedure is not compatible with Basic and may cause the error message "RETURN without GOSUB" to be displayed, even though no such error exists. In some cases, the program may work correctly in the trace mode or even in the normal mode after the program has been run once with the trace function on.

This information applies to QuickBasic Versions 4.00, 4.00b, and 4.50, Microsoft Basic Compiler Version 6.00 and 6.00b for MS-DOS and MS OS/2, and Microsoft Basic PDS Version 7.00 for MS-DOS and OS/2. Please note that Basic PDS 7.00 for MS-DOS and has its own ISAM file system, making Btrieve, a third-party ISAM support product, unnecessary.

MORE INFORMATION

This compatibility problem occurs whether executed from within the QB.EXE environment of QuickBasic, the QBX.EXE environment of the Basic PDS 7.00, or from an executable program compiled with BC.EXE.

The solution to the problem is to use the older Btrieve procedure named BTRV. Shown below is the only change necessary for most programs using BTRVFAR to convert them to use BTRV.

Code Example

' This code is incomplete; only the highlights are shown
OPEN "NULL" FOR RANDOM AS #1 LEN = 40
FIELD #1 40 AS A$
OP%=0
BLK$=SPACE$(128)
BLEN%= 40
KBUF$ = "FileName"
KNUM% = 0

FCB% = SADD(A$) - 188

'Use:
  CALL BTRV( OP%, STAT%, BLK$, FCB%, BLEN%, KBUF$, KNUM%)
'Instead of:
'  CALL BTRVFAR(OP%,STAT%,BLK$,SADD(A$),VARSEG(A$),BLEN%,KBUF$,KNUM%);
				

Modification Type:MinorLast Reviewed:1/9/2003
Keywords:KB42466