Microsoft KB Archive/33621

= &quot;RETURN without GOSUB&quot; When ON ERROR and CHAIN in 4.00b =

Article ID: 33621

Article Last Modified on 11/21/2006



This article was previously published under Q33621



SYMPTOMS
If the following program is compiled in QuickBasic Version 4.00b or 4.50 or Microsoft Basic Compiler Version 6.00 or 6.00b and CHAINed to/from another program, the error message &quot;RETURN without GOSUB in line 10 of module&quot; is generated. This problem does not occur when executed inside the QuickBasic environment or if the two programs are compiled with the same switches or if A.BAS is compiled with /O switch.



STATUS
Microsoft has confirmed this to be a bug in QuickBasic Versions 4.00b and 4.50 and in Microsoft Basic Compiler for MS-DOS and OS/2 (buglist6.00, buglist6.00b). This problem has been corrected in Microsoft Basic Compiler Version 7.00 (fixlist7.00).



MORE INFORMATION
The following is a code example: ' A.BAS, the CHAINing program: CHAIN &quot;B&quot;

' B.BAS, the CHAINed-to program: ' Will give error message unless A.BAS was compiled with /E or /X. GOSUB sub1 PRINT &quot;It works!&quot; END sub1: PRINT &quot;Here I am!&quot; ON 1 GOSUB sub2 PRINT &quot;I'm back!&quot; 10   RETURN                  'Says RETURN without GOSUB here when 'compiled. sub2: PRINT &quot;I'm down here!&quot; RETURN sub3: ON ERROR GOTO OhNo     'Should never get to this line. OhNo: END                    'Never gets to this line.

Additional query words: QuickBas buglist4.00b buglist4.50

Keywords: KB33621

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.